我遵循了关于如何为 Mac OS X 提供 OpenMP 支持编译 clang(++) 的出色演练 here .但是,在编译一个简单的测试程序时:
#include <iostream>
int main(int argc, char** argv)
{
std::cout << "Hello world!" << std::endl;
return 0;
}
...我只是得到:
$> clang2++ -Wall -std=c++11 -stdlib=libc++ -fopenmp -o openmp openmp.cpp
openmp.cpp:2:10: fatal error: 'iostream' file not found
#include <iostream>
我新编译的 clang 项目似乎不包含 libc++,即使包含标准目录(“标准”afaik),即:
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
……还是不行。有没有其他人遇到过这个并找到了解决方案?谢谢。
最佳答案
我通过在 Clang/OpenMP 构建过程中添加一个缺失的步骤成功编译了 clib++。
在 Clang/OpenMP 页面 ( http://clang-omp.github.io/ ) 它要求您下载以下内容:-
$ git clone https://github.com/clang-omp/llvm
$ git clone https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt
$ git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang
如果你想包含 c++11 支持,你还应该下载:- $git 克隆 https://github.com/llvm-mirror/libcxx llvm/项目/libcxx
其中一个构建参数是 LLVM_EXTERNAL_LIBCXX_SOURCE_DIR(在 CMakeCache.txt 中定义),它需要 libcxx 在此位置。
*注意。我不得不对 Kyle Halladays OSX Mavericks 说明中提到的构建说明进行轻微修改,替换为: ../configure --enable-optimized 和 ../configure --enable-optimized CC=/usr/bin/clang CXX=/usr/bin/clang++
关于c++ - 包括未找到的 clang++ + OpenMP + stdlibc++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26357126/