Resuelto: Se desconoce la identificación del compilador de C

# whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc
# whereis g++
g++: /usr/bin/g++  
# gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake:

rebuild
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
  The CMAKE_C_COMPILER:

    /usr/local/bin/gcc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:7 (project):
  The CMAKE_CXX_COMPILER:

    /usr/local/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.

Consulte la práctica en línea:

sudo apt-get update
sudo apt-get install -y build-essential

No se puede resolver. La razón puede ser que las rutas de gcc y g ++ son inconsistentes con las rutas de gcc y g ++ utilizadas en cmake.

# 指定gcc、g++的路径
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ ..

Supongo que te gusta

Origin blog.csdn.net/weixin_40437821/article/details/113856763
Recomendado
Clasificación