我最近在我的 Macbook Pro 上安装了 Macports,并安装了该gcc47
端口。在添加alias g++="g++-mp-4.7"
到我.profile
并确保我正在使用g++-4.7
之后,我尝试构建我的一个使用 C++11 的项目。但是,我收到此错误:
cc1plus: error: unrecognized command line option "-std=c++11"
我觉得这很奇怪,因为 Macports 构建了支持 C++ 的 gcc,所以我希望 C++11 应该可以正常工作。我已经粘贴了g++ -v
下面的输出。您对为什么g++-mp-4.7
不将其识别-std=c++11
为有效选项有任何想法吗?
COLLECT_GCC=g++-mp-4.7
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.7.1/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: ../gcc-4.7.1/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --enable-stage1-checking --disable-multilib --enable-lto --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --with-pkgversion='MacPorts gcc47 4.7.1_2'
Thread model: posix
gcc version 4.7.1 (MacPorts gcc47 4.7.1_2)