CMake cl.exe无法编译简单的测试程序

时间:2015-05-31 02:41:53

标签: visual-c++ cmake

这是CMake输出:

-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/amd64/cl.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: E:/Code/Git/Brendan-C-SFML/build/CMakeFiles/CMakeTmp

我已经检查了一些其他问题,他们说降级到.NET 4.0,但这对我没用。

4 个答案:

答案 0 :(得分:0)

在这个答案中:Cmake is Unable to Configure Project for Visual Studios 10 amd64

我找到了解决问题的方法。

对我来说是:

  

我发现安装了SP后,我的x64编译器被破坏了。请尝试使用此更新来恢复它们:http://www.microsoft.com/en-us/download/details.aspx?id=4422

我已经更新了编译器,现在它可以正常工作。

答案 1 :(得分:0)

尝试使用新的cvtres.exe替换Microsoft Visual Studio 10.0 \ VC \ bin \ cvtres.exe,我使用了vs2012中的那个,它可以正常工作!不要忘了备份。

答案 2 :(得分:0)

如果带有CMake的Qt Creator 4.7.0: 我通过在Tools-> Options-> Kits-> Kits-> CMake generator中将生成器从“ NMake Makefiles JOM”更改为“ NMake Makefiles”来解决了这个问题。

答案 3 :(得分:0)

我在 Visual Studio 2019(在 Windows 10 上)遇到了类似的问题。

我搜索了它,这是唯一一个(在标题中)与我从 Visual Studio 获得的输出相似的 stackoverflow 问题。我不确定是否应该创建一个问题来自己回答,所以遇到同样问题的人可能会找到这个解决方案。这就是我写在这里的原因。

无论如何,保存 CMake“项目”(由 Visual Studio 创建)并重新启动程序解决了问题。

相关问题