CMake Error at CMakeLists.txt:5 (PROJECT): The CMAKE_C_COMPILER: cl is not a full path
报错:
- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (PROJECT):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
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:5 (PROJECT):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
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 “E:/gc/c_test1/build/CMakeFiles/CMakeOutput.log”.
See also “E:/gc/c_test1/build/CMakeFiles/CMakeError.log”.
解答:
1.不用cmake.. 用下面的命令
cmake -G "MSYS Makefiles" ..
2.如果第一个不行,那么设置路径:
$ export CC=/c/MinGW/bin/gcc.exe
$ export CXX=/c/MinGW/bin/g++.exe
$ cmake -G "MinGW Makefiles" ..
-- The CXX compiler identification is GNU 4.8.1
...
$ mingw32-make
第2种:
$ cmake -DCMAKE_C_COMPILER=/c/MinGW/bin/gcc.exe -DCMAKE_CXX_COMPILER=/c/MinGW/bin/g++.exe ..
如果还不行,参考下面链接:
https://www.e-learn.cn/content/wangluowenzhang/22835
https://stackoverflow.com/questions/29746950/cmake-cannot-find-compiler
还没有评论,来说两句吧...