OS X:已安装的gcc链接到clang [英] OS X: installed gcc links to clang
本文介绍了OS X:已安装的gcc链接到clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经安装了 gcc
和 g ++
:
$ which gcc
/usr/bin/gcc
$ which g++
/usr/bin/g++
$ brew install gcc
Warning: gcc-6.2.0 already installed
我遵循在gcc编译器上编译OpenMP程序OS X Yosemite 通过HomeBrew重新安装 gcc
:
I follow Compile OpenMP programs with gcc compiler on OS X Yosemite to reinstall gcc
via HomeBrew:
$ 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 ++
?
What's happening with this redirection? How could I use gcc
/g++
?
尽管涉及,但与 OpenMP
无关.
推荐答案
brew
将工具安装在/usr/local/bin
中.使用/usr/local/bin/g ++ 6
:
brew
installs tools in /usr/local/bin
. Use /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.
这篇关于OS X:已安装的gcc链接到clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文