【发布时间】:2016-06-22 12:39:44
【问题描述】:
我尝试在 Windows 上运行 CMake,但出现以下错误:
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (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.
但是我的“CC”环境变量被设置了!
>>echo %CC%
C:\Anaconda2\MinGW\x86_64-w64-mingw32\bin\gcc.exe
【问题讨论】:
-
您可以拨打您正在使用的
cmake.exe ...电话吗?一种猜测是C:\Anaconda2\MinGW\x86_64-w64-mingw32\bin不是您的PATH环境变量的一部分(如错误消息所示)。另请参阅here。 -
@Florian 只是正常的调用:“cmake ..”。是的,它不是我的
PATH的一部分,错误说:通过将环境变量“CC”或 CMake 缓存条目 CMAKE_C_COMPILER 设置为编译器的完整路径或编译器名称,告诉 CMake 在哪里可以找到编译器在 PATH 中。”所以我的 CC 指向完整路径,而不仅仅是名称.. 应该没有任何问题 -
@JoãoAbrantes 您还必须将 MinGW 二进制目录添加到
PATH,因为gcc.exe确实依赖于该目录中的 DLL。如果我在the Dependency Walker application 中查看我的gcc.exe,我会得到例如对LIBWINPTHREAD-1.DLL的引用。 -
@Florian 好的,我现在已将 MinGW 二进制目录添加到 PATH。但是错误仍然存在:(