Reputation: 343
On a Red Hat Linux station, I use the devtoolset2 giving the following command:
scl enable devtoolset-2 bash
Then, when I call gcc --version, I get :
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
But if I compile my program (malkefile generated with cmake, adding the line :
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
endif()
I have the following error message :
cc1plus: error: unrecognized command line option "-std=c++11"
And if I compile replacing -std=c++11 by -std=c++0x then, I obtain these messages :
nullptr wasnt declared in this scope.
How nullptr cannot be recognized considering it is a keyword ?
I don't understand, if you have any idea...
Upvotes: 3
Views: 1457
Reputation: 385144
You are not invoking GCC 4.8.2.
Either there is something wrong with your CMake configuration, or there is something wrong with your SCL invocation, or gcc -v
gives a different answer to g++ -v
(in which case, check the contents of your toolset).
But nullptr
not being available, and -std=c++0x
being accepted but not -std=c++11
, all suggest GCC 4.3, 4.4 or 4.5.
One thing you can try is to remove the file CMakeCache.txt
from your build root, which may contain cached properties of your previous environment.
Failing that, turn on verbose output so you can really see what's going on, what binaries are being invoked, and how.
Upvotes: 5