compile Error with default -std=c++11

I am new to CLIon; I keep on getting the following error

default CMakeList.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

==> cc1plus: error: unrecognized command line option "-std=c++11"

I check the setting that CLion C++ compiler point to
ToolChains settings ==> /usr/bin/c++
while my CentOS box has

shall I change the CLion setting to point to /usr/local/gcc/bin/c++? and how can I do that ?
Comment actions Permalink

Hello Mike,

you are right. In such a case you should specify a compiler explicitly. To do that:
- in the main menu, under File | Settings | Build, Execution, Deployment | Cmake, find the CMake Options Field (on the right pane). In this field, specify the fully qualified name of your compiler, as in example:

-D CMAKE_CXX_COMPILER=/usr/local/gcc/bin/c++.

You can find that information and more usefull CMake related tips here:

Comment actions Permalink

Thanks. It works!


Please sign in to leave a comment.