我试图在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 …Run Code Online (Sandbox Code Playgroud) 我是新手cmake,只是安装它并遵循这篇文章:
http://www.cs.swarthmore.edu/~adanner/tips/cmake.php
D:\Works\c\cmake\build>cmake ..
-- Building for: NMake Makefiles
CMake Warning at CMakeLists.txt:2 (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 Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE):
To use …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的 windows 桌面上安装一个名为 NUPACK 的软件套件,用于设计核酸反应途径。http://www.nupack.org/
这个软件需要安装CMake,据我了解,CMake本身没有编译器,需要我们单独安装编译器。因此,我下载了 MinGW 以用作 C++ 编译器。在运行之前,我已经设置了 CMake 和 MinGW 的 bin 的环境变量。我正在通过命令提示符运行 CMake(版本 3.11.1),但我一直遇到以下问题:
C:\Users\Nicholas\Documents\nupack\build>Cmake -DCMAKE_INSTALL_PREFIX=NUPACKINSTALL -G "MinGW Makefiles" ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-
3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
Run Code Online (Sandbox Code Playgroud)
我猜 CMake 无法以某种方式识别我的 MinGW gcc …
我在 Windwos 上试图让 Mingw-w64 与 CMake 一起工作,因为我的 MSVC 不知何故根本无法工作(使用 Windows10 64bit.
基本上我将参数添加-DCMAKE_CXX_COMPILER="C:/MinGW-w64/mingw64/bin/g++.exe" -DCMAKE_C_COMPILER="C:/MinGW-w64/mingw64/bin/gcc.exe"到我对设置相应编译器的 CMake 的调用中。
但是我收到这些错误:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW-w64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/MinGW-w64/mingw64/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW-w64/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
Run Code Online (Sandbox Code Playgroud)
我怎么能让这个工作?
我正在尝试一个 hello world 测试来在 Windows 下制作 cmake,使用 MinGW 作为编译器。
此答案建议cmake使用以下-G标志运行:
cmake -G "MinGW Makefiles" .
Run Code Online (Sandbox Code Playgroud)
但是,如果我这样做,我会收到一条消息,说那不是已知的生成器。实际上,运行cmake --help,在Generators部分下列出了以下生成器:
如您所见,未列出“MinGW Makefiles”。
如果这是相关的,我已经安装了 MinGW 并在我的系统上的常用文件夹中工作C:\MinGW。我还通过 WinBuilds 和 MSYS2 安装了 MinGW-w64,同样在默认安装文件夹中。我正在使用cmake version 3.5.2,通过 MSYS2 安装。
为什么“MinGW Makefiles”没有在生成器中列出?