cc1plus:错误:无法识别的命令行选项“-std = c ++ 0x”

时间:2015-11-10 06:47:02

标签: c++ c++11 gcc makefile

我正在尝试make使用g++。首先,我通过在本地编译包来升级我的gcc版本,并添加一些环境路径到我的~/.bashrc

alias gcc='/home/rescape/lib/bin/gcc'
alias g++='/home/rescape/lib/bin/g++'
export CC=/home/rescape/lib/bin/gcc
export CPP=/home/rescape/lib/bin/cpp
export CXX=/home/rescape/lib/bin/c++

我在终端尝试g++ -v

[rescape@iZ231twjza6Z mxnet]$ g++ -v
Using built-in specs.
COLLECT_GCC=/home/rescape/lib/bin/g++
COLLECT_LTO_WRAPPER=/home/rescape/lib/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --prefix=/home/rescape/lib/
Thread model: posix
gcc version 4.8.0 (GCC) 

仍然,当我make时,会出现此类错误消息:

[rescape@iZ231twjza6Z mxnet]$ make
g++ -std=c++0x -DMSHADOW_FORCE_STREAM -Wall -O3 -I./mshadow/ -I./dmlc-core/include -fPIC -Iinclude -msse3 -funroll-loops -Wno-unused-parameter -Wno-unknown-pragmas -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMSHADOW_RABIT_PS=0 -DMSHADOW_DIST_PS=0 -DMXNET_USE_OPENCV=1 `pkg-config --cflags opencv` -fopenmp  -MM -MT build/resource.o src/resource.cc >build/resource.d
cc1plus: error: unrecognized command line option "-std=c++0x"
make: *** [build/resource.o] Error 1

有关如何解决此问题的任何建议?谢谢!

1 个答案:

答案 0 :(得分:1)

根据这个:

  

[rescape @ iZ231twjza6Z mxnet] $ make

     

g ++ ...

您不在Makefile中使用CXX变量,因此只需将g++替换为CXX中的Makefile。别名仅在您在shell中输入命令时才有效,如果您键入g++ something.cpp bash execute /home/bin/g++ something.cpp,那么全部,bash别名如果外部进程无法帮助(在我们的案例中为make) )执行g++