我已安装gcc
和g++
:
$ which gcc
/usr/bin/gcc
$ which g++
/usr/bin/g++
$ brew install gcc
Warning: gcc-6.2.0 already installed
我按照Compile OpenMP programs with gcc compiler on OS X Yosemite通过HomeBrew重新安装gcc
:
$ brew reinstall gcc --without-multilib
然后
$ /usr/bin/g++ openmp.cpp
openmp.cpp:12:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
-fopenmp
$ /usr/bin/g++ openmp.cpp -fopenmp
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
此重定向发生了什么?我如何使用gcc
/ g++
?
虽然涉及,但不是OpenMP
。
答案 0 :(得分:2)
brew
在/usr/local/bin
中安装工具。使用/usr/local/bin/g++6
:
$ /usr/local/bin/g++-6 --version
g++-6 (Homebrew gcc 6.2.0) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.