CXX Cmake编译器未知

时间:2018-04-06 23:46:53

标签: ubuntu gcc cmake

 ./cmake-3.4.1/bin/cmake ..
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/c++

  is not a full path to an existing compiler tool.

  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.

说它无效,但

/usr/bin/c++ is a valid path

为什么会显示此错误?

我试过了

/cmake-3.4.1/bin/cmake -DCMAKE_CXX_COMPILER=/usr/bin/c++

仍然出现此错误

修改

xmr-stak/build# ./cmake-3.4.1/bin/cmake ../ -DCMAKE_CXX+COMPILER=/usr/bin/g++
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/c++

  is not a full path to an existing compiler tool.

  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.


-- Configuring incomplete, errors occurred!
See also "/root/monero/xmr-stak/build/CMakeFiles/CMakeOutput.log".
See also "/root/monero/xmr-stak/build/CMakeFiles/CMakeError.log".

来自cmake日志:

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/c++
Build flags:
Id flags:

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/c++
Build flags:
Id flags: -c

The output was:
No such file or directory

1 个答案:

答案 0 :(得分:0)

我非常怀疑你有误导(注意g中的g++):

cmake ../ -DCMAKE_CXX_COMPILER=/usr/bin/g++

如果确实有名为c++的编译器可执行文件,请确保以下内容有效:

$ /usr/bin/c++ --version