ubuntu - CXX Cmake 编译器未知

标签 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

最佳答案

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

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

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

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

关于ubuntu - CXX Cmake 编译器未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49702384/

相关文章:

postgresql - 无法在ubuntu中安装postgres

python - 无法安装 Pip 包

android - 链接器找不到函数

ubuntu - 编译Nachos源码报错 "gnu/stubs-32.h: No such file or directory"

c++ - CMake 中的 include_directories 和 target_include_directories 有什么区别?

Php SoapClient 超时(ubuntu)

swift - vapor:地址已在使用中(错误号:98)

c - 是否可以在不同语句的函数中分配相同的内存

c++ - 静态链接的boost库的动态链接错误

path - Cmake 错误 : Invalid escape sequence\U