OS X:安装 gcc 链接到 clang [英] OS X: installed gcc links to clang
本文介绍了OS X:安装 gcc 链接到 clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经安装了 gcc
和 g++
:
I already have gcc
and g++
install:
$ 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
无关.
Though involved, it's not about 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屋!
查看全文