1、问题
cmake出现以下错误:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:1 (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.
2、分析
出现该错误的原因是因为cmake找不到C++的编译器(比如找不到g++)
3、解决
(1)更新软件源
sudo apt-get update
(2)安装build-essential
另:因为gcc不包含g++。可单独安装g++
apt-get install g++
(3)查看g++版本
g++ --version