No CMAKE_CXX_COMPILER could be found

/home/username/MyQtExample/camera/CMakeLists.txt:5: error:
No CMAKE_CXX_COMPILER could be found.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.

全新安装的Ubuntu22.04版本,全新在线安装Qt_4.5.2.run , Qt版本6.4.0,Qt Creator版本10.0.0,算是比较新的系统和工具,但是运行Qt Creator自带例程时,出现了CMake_CXX_COMPILER没有发现的问题。顺着这个提示,去构建与运行的设置了看了一下,的确GCC和G++一栏是空的,然后

gcc --version
g++ --version

也报not found,那就按照这个信息,去安装gcc和g++,执行了:

sudo apt install gcc
sudo apt install g++

然后再上面的版本看下就有了,再打开Qt的构建和运行,默认的desktop里也有了gcc和g++了,默认路径是:

/usr/bin/gcc
/usr/bin/g++

但是Qt的例程仍然报编译器找不到这个错误。

有个

猜你喜欢

转载自blog.csdn.net/weixin_49369227/article/details/129913371
今日推荐