0

I have a problem with Kdevelop 5.2.1 under ubuntu 18.04.1, Kdevelop refuses to choose GCC 8.1, he chooses the default version 4.9.

I tried this in CMake:

set(CMAKE_C_COMPILER "gcc-8.1")
set(CMAKE_CXX_COMPILER "/usr/bin/g++-8")

and I tried this add g++ in C/C++ compiler option (usr/bin/g++-8 or usr/bin/gcc-8), but it disappears as soon as I close the option window and reopen it.

I remove GCC/G++ 4.9, I have error in Kdevelop and refuses GCC 8 or G++ 8 in /usr/bin/g++-8 or gcc-8.

I know the compiler revision with this code :

#include <iostream>

int main(int argc, char **argv) {
    std::cout << __cplusplus << std::endl;
    return 0;
}

Output this : 201402

Thank you in advance for your answers :) ,

jww
  • 97,681
  • 90
  • 411
  • 885
Bensuperpc
  • 1,275
  • 1
  • 14
  • 21
  • 1
    I believe `command -v g++` is used to detect which compiler is used by default. I also seem to recall this is one of those simple tasks that CMake makes difficult. Also see [How to check if command exists in a shell script?](https://stackoverflow.com/q/7522712/608639) and [Unable to specify the compiler with CMake](https://stackoverflow.com/q/13054451/608639). – jww Jul 29 '18 at 18:57
  • 1
    "C/C++ compiler option": Are you referring to that page in the project configuration dialog? If so, that's just for KDevelop's internal parser for displaying diagnostics, etc.. – kfunk Aug 22 '18 at 20:36
  • 1
    Setting `CMAKE_CXX_COMPILER` to the right compiler should have the desired effect. Could you check in CMakeCache.txt inside the project's build dir whether `CMAKE_CXX_COMPILER` was actually set? Check with `grep CXX_COMPILER CMakeCache.txt` – kfunk Aug 22 '18 at 20:38

0 Answers0