• <bdo id='d1Z95'></bdo><ul id='d1Z95'></ul>
      <legend id='d1Z95'><style id='d1Z95'><dir id='d1Z95'><q id='d1Z95'></q></dir></style></legend>

      <small id='d1Z95'></small><noframes id='d1Z95'>

    1. <i id='d1Z95'><tr id='d1Z95'><dt id='d1Z95'><q id='d1Z95'><span id='d1Z95'><b id='d1Z95'><form id='d1Z95'><ins id='d1Z95'></ins><ul id='d1Z95'></ul><sub id='d1Z95'></sub></form><legend id='d1Z95'></legend><bdo id='d1Z95'><pre id='d1Z95'><center id='d1Z95'></center></pre></bdo></b><th id='d1Z95'></th></span></q></dt></tr></i><div id='d1Z95'><tfoot id='d1Z95'></tfoot><dl id='d1Z95'><fieldset id='d1Z95'></fieldset></dl></div>
      <tfoot id='d1Z95'></tfoot>
      1. 如何在 OS X 中包含 omp.h?

        时间:2023-09-19

        <legend id='FG4gA'><style id='FG4gA'><dir id='FG4gA'><q id='FG4gA'></q></dir></style></legend>
        1. <small id='FG4gA'></small><noframes id='FG4gA'>

            • <bdo id='FG4gA'></bdo><ul id='FG4gA'></ul>
                <tbody id='FG4gA'></tbody>

                  <i id='FG4gA'><tr id='FG4gA'><dt id='FG4gA'><q id='FG4gA'><span id='FG4gA'><b id='FG4gA'><form id='FG4gA'><ins id='FG4gA'></ins><ul id='FG4gA'></ul><sub id='FG4gA'></sub></form><legend id='FG4gA'></legend><bdo id='FG4gA'><pre id='FG4gA'><center id='FG4gA'></center></pre></bdo></b><th id='FG4gA'></th></span></q></dt></tr></i><div id='FG4gA'><tfoot id='FG4gA'></tfoot><dl id='FG4gA'><fieldset id='FG4gA'></fieldset></dl></div>

                  <tfoot id='FG4gA'></tfoot>
                  本文介绍了如何在 OS X 中包含 omp.h?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我是 C 新手,在 OS X 中编译代码时遇到一些问题.

                  I'm new in C and have some problems compiling my code in OS X.

                  我在 Eclipse 中编写了很多 Java 代码,并使用终端来编译我的代码.但是现在我正在学习 openMP 并且遇到了麻烦.

                  I code Java a lot both in Eclipse and use terminal to compile my code. However now I'm learning openMP and have troubles with it.

                  首先我下载了​​ Xcode 来编写 openMP 代码,但它无法识别 <omp.h>.然后我安装了 g++.当我在终端中输入 g++ -v 时,我得到了这个:

                  First I downloaded Xcode to write openMP code but it didn't recognize <omp.h>. Then I installed g++. When I type g++ -v into terminal I get this:

                  Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
                  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
                  Target: x86_64-apple-darwin13.3.0
                  Thread model: posix
                  

                  但是当我使用 g++ Mesh.cpp -fopenmp 我仍然得到

                  But when I use g++ Mesh.cpp -fopenmp I still get

                  Mesh.cpp:4:10: fatal error: 'omp.h' file not found
                  #include <omp.h>
                           ^
                  1 error generated.
                  

                  然后我尝试将 PTP 安装到我的 Eclipse 中,但遇到了同样的问题.我以为我的 MacBook 中没有 omp.h 所以我搜索它并在 gcc-4.9.1/build/下的文件夹下找到了几个 omp.h.

                  Then I tried to install PTP into my Eclipse and got the same problem. I thought there was no omp.h in my MacBook so I searched for it and found several omp.h under folders under gcc-4.9.1/build/.

                  问题来了.根据 Java 经验,我拥有该文件但无法使用它的唯一原因是类路径错误.但是,我不知道如何在 g++、Xcode 或 Eclipse 中更改此配置.但是因为我可以包含像 <stdio.h> 这样的文件并用所有的 IDE 编译它,我怎么不能用 <omp.h> 做同样的事情?

                  Here comes the problem. Based on the Java experience the only reason why I have the file but cannot use it is that the Class Path is wrong. However, I have no idea how to change this configuration in g++, or in Xcode, or in Eclipse. But since I can include files like <stdio.h> and compile it with all the IDEs, how can't I do the same with <omp.h>?

                  我注意到的另一件事是 gcc 文件夹版本是 4.9.1,但是当我在终端中输入 gcc -v 时,我在输入 g++ -v

                  Another thing I noticed is that the gcc folder version is 4.9.1, but when I type gcc -v into terminal I get the same with typing in g++ -v

                  Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
                  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
                  Target: x86_64-apple-darwin13.3.0
                  Thread model: posix
                  

                  版本信息不应该是关于 4.9.1 的吗?就像 java -version 显示的那样

                  Shouldn't the version information says something about 4.9.1? Just like what java -version shows

                  java version "1.8.0_11"
                  Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
                  Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
                  

                  感谢阅读.任何帮助表示赞赏.

                  Thanks for reading. Any help is appreciated.

                  推荐答案

                  GCC 4.9.1 通常不随 OS X 一起提供(实际上 GCC 不再随 Xcode 一起提供).您的必须是通过其他方式安装的,例如自制程序或自编译,如此处所述.您可能缺少的是正确设置 PATH 变量或额外安装的编译器具有版本后缀的二进制文件,即 gcc-4.9g++-4.9而不是简单的 gcc/g++.

                  GCC 4.9.1 normally does not ship with OS X (actually no GCC ships with Xcode any more). Yours must have been installed by another means, e.g. Homebrew or self compilation as described here. What you are probably missing is properly set PATH variable or the additionally installed compiler has version-suffixed binaries, i.e. gcc-4.9 or g++-4.9 instead of simply gcc / g++.

                  正如@rubenvb 已经提到的,Apple 使用类似 GCC 的名称对 Clang 可执行文件进行符号链接.我个人认为这是一种不好的做法,因为 Xcode 附带的最新 Clang 版本会对无法识别的命令行选项(例如 GCC 前端特定选项)做出反应,并出现硬错误.

                  As @rubenvb has already mentioned, Apple symlinks the Clang executables with GCC-like names. I personally find that a bad practice since recent Clang versions shipped with Xcode react on unrecognised command-line options (e.g. GCC frontend specific ones) with hard errors.

                  这篇关于如何在 OS X 中包含 omp.h?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  • <bdo id='quNiK'></bdo><ul id='quNiK'></ul>

                    <small id='quNiK'></small><noframes id='quNiK'>

                        • <legend id='quNiK'><style id='quNiK'><dir id='quNiK'><q id='quNiK'></q></dir></style></legend>

                          <tfoot id='quNiK'></tfoot>

                        • <i id='quNiK'><tr id='quNiK'><dt id='quNiK'><q id='quNiK'><span id='quNiK'><b id='quNiK'><form id='quNiK'><ins id='quNiK'></ins><ul id='quNiK'></ul><sub id='quNiK'></sub></form><legend id='quNiK'></legend><bdo id='quNiK'><pre id='quNiK'><center id='quNiK'></center></pre></bdo></b><th id='quNiK'></th></span></q></dt></tr></i><div id='quNiK'><tfoot id='quNiK'></tfoot><dl id='quNiK'><fieldset id='quNiK'></fieldset></dl></div>

                            <tbody id='quNiK'></tbody>