How to use latest GCC with CLion in Linux-Mint

The default GCC in Linux-Mint is not up to date. To install the latest version, follow these steps:

  1. sudo add-apt-repository ppa:ubuntu-toolchain-r/test
  2. sudo apt-get update
  3. sudo apt-get install gcc-5 g++-5

Now if you execute in a terminal

g++-5 –version

You should get the correct version.

Next, in CLion, go to Settings -> Build, Execution, Deployment -> CMake. Under CMake options, add

-D CMAKE_CXX_COMPILER=g++-5

That should do it.

In general, note that CLion just uses CMake to do the compiling, so its really CMake that you have to configure to use a different compiler. More details on how to do this can be found here:

https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F

 

Leave a comment