启用openmp时出错 - “ld:未找到-lgomp的库”和Clang错误 [英] Error enabling openmp - "ld: library not found for -lgomp" and Clang errors

查看:1051
本文介绍了启用openmp时出错 - “ld:未找到-lgomp的库”和Clang错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获得openmp在我的程序中运行Mavericks,但是当我尝试使用标志 -fopenmp 编译时,我得到以下错误: p>

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编译的任何建议? p>

Any suggestions on how to fix my Clang errors and get openmp to compile?

推荐答案

最新Xcode套件中的 gcc 命令不再是GCC前端到LLVM(基于非常古老的GCC 4.2.1),而是一个符号链接到 clang 。 Clang(尚未)支持OpenMP。您必须单独安装另一个版本的GCC,例如通过遵循本教程或使用任何可用的软件包管理系统如 MacPorts Homebrew

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:未找到-lgomp的库”和Clang错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆