2

I am trying to make using g++. At first, I upgraded my gcc version by compiling the package locally, and add some environment path to my ~/.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++

And I try g++ -v in terminal:

[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) 

Still, When I do make, such error message occurs:

[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

Any suggestions of how to fix this? Thanks!

skfeng
  • 669
  • 2
  • 7
  • 15
  • "add some environment path" -- That isn't what your aliases are doing. What happens when you actually modify your environment's `PATH` variable? –  Nov 10 '15 at 07:04
  • 3
    My psychic powers tell me that you your Makefile is hardcoding`g++` as a rule instead of using `CXX`. And it's picking up the other copy of g++ you didn't know you already had installed from your PATH. Try setting your PATH as follows: `PATH=/home/rescape/lib/bin:"$PATH"` – selbie Nov 10 '15 at 07:17
  • 2
    how about `-std=c++11`? – The Paramagnetic Croissant Nov 10 '15 at 07:25
  • @selbie,Thanks, that works! – skfeng Nov 11 '15 at 06:10

1 Answers1

1

According to this:

[rescape@iZ231twjza6Z mxnet]$ make

g++ ...

You not use CXX variable in your Makefile, so just replace g++ with CXX in your Makefile. aliases works only when you enter commands in your shell, if you type g++ something.cpp bash execute /home/bin/g++ something.cpp, that's all, bash aliasing not help if external process (in our case make) execute g++

Community
  • 1
  • 1
fghj
  • 8,898
  • 4
  • 28
  • 56