|
No CMAKE_CXX_COMPILER could be found. 错误解决由于项目借助cmake进行编译时,需要升级g++,所以就安装了新版本,一阵操作猛如虎,结果cmake直接告诉我 CMake Error at CMakeLists.txt:7 (project): 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.
要解决这个问题,首先看看系统能不能找到g++进行编译 如上图,gcc可以找到,但是g++就不行了。 接下来,输入 ls /usr/bin | grep g++
可以看到的是,原来我安装了这么多的g++。其实,g++对应的是/usr/bin下面的一个软链接,所以,通常是这个软链接出问题了,因此可以对于它直接删除,然后重新创建。 sudo rm /usr/bin/g++ 然后,找到版本最新的g++,也就是g++-10,可以看到 原来这是同路径另一个文件的软链接,然后,建立一个新的软链接 sudo ln -s g++-10 /usr/bin/g++ 这时候,系统和cmake都可以找到g++了! ———————————————— 版权声明:本文为CSDN博主「海滩油炸」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/m0_47096428/article/details/123955751 |