我收到以下错误
工作:Microsoft Windows [Versión6.1.7601]
错误:
CMake Warning at CMakeLists.txt:4 (project):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
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:4 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
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!
如果somone可以提供帮助......
答案 0 :(得分:1)
在运行cmake之前,您需要运行Visual Studio提供的批处理脚本来设置环境。它在X:\Visual\Studio\Dir\VC\vcvarsall.bat
下。在开始菜单中还应该有一个快捷方式,用于" Visual Studio命令提示符"这将打开提示并自动运行vcvarsall.bat
。
答案 1 :(得分:0)
尝试使用“Visual Studio命令提示符”(vcvarsall.bat)
答案 2 :(得分:0)
正如其他人所说,您可以在“Visual Studio命令提示符”中运行cmake,路径@Miles说或(更好的方式)将visual studio编译器的路径添加到您的路径中。检查此路径:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
并在计算机中找到它,然后将其添加到PATH环境变量中。
答案 3 :(得分:0)
我遇到了同样的问题。我意识到cl不会随Visual Studio 2015一起提供,但是当我安装2013 express时,它确实有效。
使用“Visual Studio 2013” - > “Visual Studio工具” - > “VS2013 x64交叉工具命令提示符”。
答案 4 :(得分:0)
请注意,我通过将其添加到安装了Visual Studio 2019的PATH环境变量中来解决了该问题:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\Hostx64\x64