为什么Cmake找不到编译器CL
Why is cmake not finding the compiler cl
我试图将一组可执行文件安装到运行Windows 10的计算机上,然后下载了源后,我需要使用CMAKE对其进行编译。我下载了最新版本的Cmake,(设置了适当的工作目录后(一直在尝试在Windows命令提示符上运行以下命令,以安装可执行文件:
mkdir build
cd build
cmake ../
make
但是,cmake命令始终产生以下错误,并且无法生成Make命令可以使用的任何形式的文件:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (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:2 (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 "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeError.log".
我已经尝试了许多解决方案以使Cmake工作,但它们都没有工作。我试图将CMAKE文件夹的垃圾箱添加到我的路径环境变量中,我试图重新安装我的Cmake副本,并尝试使用CMAKE GUI以生成Make File(在Windows上运行CMAKE(,甚至甚至是下载Visual Studio(如何在Windows上设置CMAKE CXX变量(,但是因为我没有使用CMake GUI或Visual Studio的经验,或者因为有问题出现问题,似乎根本没有用,所以cmake ../
产生完全相同的错误。
有人可以为我提供一些如何使此命令起作用的替代解决方案?
下载了二进制文件后,我需要使用cmake
对它们进行编译
这是没有意义的。您要么下载了来源需要编译它们,要么下载了 binaries ,而无需编译其他任何内容。
如果您需要编译,则必须安装编译器(例如Visual Studio(。安装了VS后,CMAKE应该毫不费力地找到它(使用VS Generator时(。
但是,您的错误消息似乎表明使用Nmake Generator,需要从命令提示符正确配置用于构建的命令提示符。安装Visual Studio时,您应该在开始菜单中的Development Command提示中有快捷方式。为您的平台启动正确的一个,然后从那里运行CMAKE。
请注意,我通过安装了Visual Studio 2019的PATH
环境变量解决了问题:
C:Program Files (x86)Microsoft Visual Studio2019ProfessionalVCToolsMSVC14.20.27508binHostx64x64
- C/C++编译器通常会删除重复的库吗
- 模板-模板参数推导:三个不同的编译器三种不同的行为
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- Win32编译器选项和内存分配
- MSVC多行宏编译器错误
- 静态数据成员的问题-修复链接错误会导致编译器错误
- C++,我收到一个无法理解的编译器错误
- 在线编译器中的分段C++没有打印消息
- CMake 和 Visual Studio 2015 - C 编译器 cl.exe 无法编译简单的测试程序
- 为什么Cmake找不到编译器CL
- 无法在终端中的 Windows 5.10.1 上运行 qt10.1 的编译器'cl'
- 如何使用Visual Studio C/C++编译器(cl.exe)来预处理我的objective-C代码
- CL和G 编译器之间的差异
- C++编译器问题:3>cl:命令行错误 D8016:'/clr'和'/arch:SSE2'命令行选项不兼容
- CL.exe 构建通用应用程序时编译器和库版本不匹配
- 在VS2015中使用cl编译器的C与c++
- 明显错误的c++代码被cl.exe编译器接受
- 相当于VC++cl编译器的gdb
- Qt Creator找不到cl.exe(VS2012)编译器
- 用于检查编译器是gcc/mingw还是VC++cl的标志