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