qtcreator中NO CMAKE_CXX_COMPILER could be found

描述

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值