描述
linux下用qtcreator打开cmake项目,发现cmake提示找不到c++编译器
CMAKE: “No CMAKE_CXX_COMPILER could be found.”
但是我明明装了g++和clang
报错提示我们可以设置环境变量或者cmake entry
Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
试了都没有用,因为我们没有用cmake环境或者shell环境,而是在qtcreator环境下
所以需要修改qtcreator的kit,so上是这样说的,在
This error appears when the compiler is not correctly set, and thus, cmake is not able to find it.
This is obvious, but when you are using QtCreator, you have to take into account where this information is defined. It is defined in the "kit" specification.
First of all, check if your "Kit" is properly configured. Go to the menus and select:
Tools->Options.
Then, in the Options window, select "Build & Run" in the left column. Then, select the "Kits" tab in the right panel. There you can see a list of the available Kits.
Select the kit you want to use. If you have more than one option and you don't know which one choose to use the default option (i.e. "Desktop Qt 5.2.1 GCC 64bit (default)").
In the kit configuration list, check the row named "Compiler". If the C++ compiler is configured as "No compiler, there is the problem. Select one of the compilers in the list (you can select the base GCC (C++) for example). Then press the "OK" button, and try to generate the project from scratch (remove the generated files and open it again).
If the compiler is configured, make sure that is the correct one, and check if the path to the binary is correct.
NOTE: If the list has not the desired compiler, you can add it in the "Compilers" tab. There, press "Add" button and select the desired options.
NOTE2: If the compiler list is empty...maybe you need to install QtCreator again.
在qtcreator选项->build&run->kit中设置c++编译器就可以
原帖:
https://stackoverflow.com/questions/50754287/qt-creator-cant-find-cmake-cxx-compiler-compiler-in-linux-mint-64-bit