Error enabling openmp - quot;ld: library not found for -lgompquot; and Clang errors(启用 openmp 时出错 - “ld: library not found for -lgomp和 Clang 错误)
问题描述
我正在尝试让 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 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:启用 openmp 时出错 - “ld: library not found for -lgomp"和 Clang 错误
基础教程推荐
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
