Visual studio 使用Visual Studio 2012/2013制作的CMake已损坏?
CMake 2.8.10.2 for Windows刚刚拒绝为我配置Visual Studio 2012项目(在Windows 7下) 似乎CMake添加了一些Microsoft编译器不再支持的设置。 链接:致命错误LNK1117:选项“清单:嵌入”中的语法错误 我试着用一个非常基本的cmake文件得到了同样的结果Visual studio 使用Visual Studio 2012/2013制作的CMake已损坏?,visual-studio,cmake,Visual Studio,Cmake,CMake 2.8.10.2 for Windows刚刚拒绝为我配置Visual Studio 2012项目(在Windows 7下) 似乎CMake添加了一些Microsoft编译器不再支持的设置。 链接:致命错误LNK1117:选项“清单:嵌入”中的语法错误 我试着用一个非常基本的cmake文件得到了同样的结果 cmake_minimum_required (VERSION 2.6) add_executable(test test.cpp) 附近有工作吗 输出窗口显示: The C co
cmake_minimum_required (VERSION 2.6)
add_executable(test test.cpp)
附近有工作吗
输出窗口显示:
The C compiler identification is MSVC 17.0.51106.1
The CXX compiler identification is MSVC 17.0.51106.1
Check for working C compiler using: Visual Studio 11
Check for working C compiler using: Visual Studio 11 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
11.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/tmp/testCmake/build/CMakeFiles/CMakeTmp
Run Build Command:C:\PROGRA~2\MICROS~2.0\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec3122367237
Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.51106.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: cmTryCompileExec3122367237, Configuration:
Debug Win32 ------
1> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01
for 80x86
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D
"CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise
/Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec3122367237.dir\Debug\\"
/Fd"C:/tmp/testCmake/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec3122367237.pdb"
/Gd /TC /analyze- /errorReport:prompt /Zm1000 testCCompiler.c
1>
1> testCCompiler.c
1>LINK : fatal error LNK1117: syntax error in option 'manifest:embed'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
Configuring incomplete, errors occurred!
CMake 2.8在Visual Studio 2012中运行良好 在您提供的日志中,请注意CMake调用Visual Studio 2012,后者反过来调用Visual Studio 2008的编译器(15.x;VS2012的编译器应为17.x): Microsoft(R)Microsoft Visual Studio 2012 11.0.51106.1版 [……] 1> 适用于80x86的Microsoft(R)32位C/C++优化编译器版本15.00.30729.01 这可能意味着您的VS2012安装配置为使用VS2008工具集。这可能意味着,当您直接在VisualStudio中构建而不仅仅是通过CMake构建时,也会发生同样的事情 这可能是由于对属性页
Microsoft.Cpp.Win32.user.props
(或Microsoft.Cpp.x64.user.props
,如果您是为x64生成的)的意外更改造成的。这些文件位于
%LOCALAPPDATA%\Microsoft\MSBuild\v4.0
。如果您看到这些属性表中的任何一个引用了VS2008的目录,那么这可能就是问题的根源
要解决此问题,您可以手动编辑所述文件(完全删除引用VS2008文件夹的XML元素),或者只需执行以下步骤:
这对我不起作用。但是,我能够删除有问题的文件(C:\Users\\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props),Visual Studio刚刚重新创建了该文件。VS2012和2013的问题都已解决。我也遇到了错误: 链接:致命错误LNK1117:选项“清单:嵌入”中的语法错误 它发生在Windows7下,VisualStudio2013社区 我尝试了很多解决方案,唯一有效的是将Visial Studio 2010完全从我的计算机中删除。没有别的办法。 我找到了一个问题,在VS2013中,变量$VCInstallDir仍然指向2010年的安装。这导致错误的LibarayPath设置和错误的工具链执行器(即使我有正确的“PlatformToolset”设置) 总而言之:
我已经在几个项目上使用VS2012一个多月了。VTK、ITK、DCMTK、GDCM和我的代码都构建得很好。我正在使用CMake 2.8.10.2。虽然我很少再为32位构建了,但我也在VisualStudio2012中使用了CMake很长一段时间,没有出现任何问题。几天前我重新安装了VisualStudio,安装了最新的更新,然后问题浮出水面:从错误信息中可以找到CL .exe(VC++编译器)——您的C.exe安装在哪里?尝试使用cl进行命令行编译(如下所述:)以确定编译器是否正常工作。也许你的VS安装搞砸了。@Vertexwahn你的说法不正确。找到了编译器,但测试编译失败,出现了jgaa给出的错误消息。它声明
使用Visual Studio 11检查C编译器是否正常工作--break
这意味着break。如果无法编译简单的测试代码,则认为编译器已损坏。我正在使用2.8.10.2和2.8.12.2,并确认Cmake和VS 2012没有问题。您可以尝试自己编译测试代码作为清单:嵌入本身并没有错。谢谢。这修复了我在Cmake和Visual Studio 2013中遇到的相同问题,尽管我试图编译一个64位版本。