铛:错误:不支持的选项'-fopenmp'

时间:2019-09-25 13:20:01

标签: macos gcc clang openmp gfortran

我是openMP的初学者,但找不到该问题的解决方案:

我正在尝试在MacBook Pro上并行编译我的hello world程序:

gcc -o hello_world -fopenmp hello_world.c 

但这给了我错误

clang: error: unsupported option '-fopenmp'

我尝试了很多建议(在网络上):

1)

brew install clang-omp

2)

brew reinstall gcc --without-multilib

3)编译

gcc-9 hello_world -fopenmp hello_world.c 

它给了我错误

-bash: gcc-9: command not found

4)和许多我不记得的其他东西。

你能帮我吗?这很烦人! 非常感谢!

关于, 尼科

编辑:

Warning: gcc 9.2.0 is already installed, it's just not linked
You can use `brew link gcc` to link this version.

AND

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

如果我制作链接gcc,我将获得:

Error: Could not symlink bin/gfortran
Target /usr/local/bin/gfortran
already exists. You may want to remove it:
 rm '/usr/local/bin/gfortran'

To force the link and overwrite all conflicting files:
  brew link --overwrite gcc

To list all files that would be deleted:
  brew link --overwrite --dry-run gcc

如果我愿意

brew link --overwrite gcc


Linking /usr/local/Cellar/gcc/9.2.0... 
Error: Could not symlink include/c++/9.2.0
/usr/local/include/c++ is not writable.

我也需要使用Fortran,我不希望在覆盖之后就无法使用! 让我知道! 谢谢!

0 个答案:

没有答案