我正在尝试让 openmp 在我的 Mavericks 程序中运行,但是当我尝试使用标志 -fopenmp
进行编译时,我收到以下错误:
I'm trying to get openmp to run in my program on Mavericks, however when I try to compile using the flag -fopenmp
I get the following error:
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我正在运行的命令是:
gcc myProgram.cpp -fopenmp -o myProgram
此外,当我运行 gcc 时,我会收到 Clang 警告,我觉得这很奇怪.并且查看/usr/bin/gcc 它似乎没有链接到 Clang.
Also, when I run gcc I get Clang warnings which I find to be very strange. And looking into /usr/bin/gcc it does not appear to link to Clang.
关于如何修复我的 Clang 错误并让 openmp 编译的任何建议?
Any suggestions on how to fix my Clang errors and get openmp to compile?
最新 Xcode 套件中的 gcc
命令不再是 LLVM 的 GCC 前端(基于非常旧的 GCC 4.2.1) 而是指向 clang
的符号链接.Clang(尚)不支持 OpenMP.您必须单独安装另一个版本的 GCC,例如通过遵循本教程或使用任何可用的软件包管理系统,如 MacPorts 和 家酿.
The gcc
command in the latest Xcode suite is no longer the GCC frontend to LLVM (based on the very old GCC 4.2.1) but rather a symlink to clang
. Clang does not (yet) support OpenMP. You have to install separately another version of GCC, e.g. by following this tutorial or by using any of the available software package management systems like MacPorts and Homebrew.
这篇关于启用 openmp 时出错 - “ld: library not found for -lgomp"和 Clang 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!