2013-04-10 99 views
3

对于Windows的CMake 2.8.10.2只是拒绝使用Visual Studio 2012(在Windows 7下)为我配置项目CMake与Visual Studio 2012/2013中断?

看起来CMake添加了一些Microsoft编译器不再支持的设置。 LINK:致命错误LNK1117:语法错误的选项“清单:嵌入”

我尝试,得到了相同的结果有一个非常基本的CMake文件

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! 
+0

我一直在使用VS2012超过1个月的几个项目。 VTK,ITK,DCMTK,GDCM都可以和我的代码一起构建。我正在使用CMake 2.8.10.2。虽然我很少再为32位构建。 – drescherjm 2013-04-10 13:54:35

+0

我也使用CMake与Visual Studio 2012相当长一段时间没有问题。我几天前重新安装了Visual Studio,安装了最新的更新,然后问题浮出水面。 – jgaa 2013-04-10 14:07:47

+0

从错误消息:无法找到cl.exe(VS C++编译器) - 您的cl.exe安装在哪里?尝试使用cl编译命令行(如此处所述:http://stackoverflow.com/questions/7865432/command-line-compile-using-cl-exe)以确定您的编译器是否正在工作。也许你的VS安装搞砸了。 – Vertexwahn 2013-08-14 19:44:12

回答

3

CMake的2.8作品以及与Visual Studio 2012

在您所提供的日志,请注意CMake的调用的Visual Studio 2012,这反过来又调用编译的Visual Studio 2008(15.x版; VS2012的编译器应该是17.x):

Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.51106.1.

[...]

1> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

这可能意味着你我VS2012的安装配置为使用VS2008的工具集。这可能意味着直接在Visual Studio中构建而不是通过CMake时,会发生同样的事情。

这可能是由于意外更改了属性页Microsoft.Cpp.Win32.user.props(或Microsoft.Cpp.x64.user.props,如果您正在为x64构建的)。这些文件驻留在 %LOCALAPPDATA%\Microsoft\MSBuild\v4.0。如果你看到任何这些属性表中引用的VS2008的目录,这可能是你的问题的根源。

为了解决这个问题,你可以手动编辑上述文件(完全去除引用VS2008文件夹中的XML元素),或只需按照this answer的步骤:

  1. Open any C++ project in Visual Studio 2012.
  2. Open View -> Other Windows -> Property Manager
  3. Double click on Microsoft.Cpp.Win32.user
  4. Go to VC++ Directories
  5. Rows which have been changed are bold. on all bold rows, click inside the text field, then on the Dropdown menu select inherit from parent or Project Defaults
  6. Click Apply, save and then close the dialog.
+0

谢谢。这为我解决了与Cmake和Visual Studio 2013相同的问题,即使我试图编译64位版本。 – Macke 2014-06-11 08:55:06

0

这并没有为工作我。但是我能够删除有问题的文件(C:\ Users \\ AppData \ Local \ Microsoft \ MSBuild \ v4.0 \ Microsoft.Cpp.Win32.user.props),Visual Studio只是重新创建了该文件。问题解决了两个VS2012和2013年

0

我也越来越错误:

LINK:致命错误LNK1117:语法错误的选项 '清单:嵌入'

它发生在Windows 7下时,Visual Studio 2013社区。

我尝试了很多解决方案,唯一的解决方法是完全从我的电脑中删除Visial Studio 2010。没有别的工作。 我得到了一个问题,在VS2013里,变量$ VCInstallDir仍然指向2010安装。这因此导致了错误的LibarayPath设置和错误的工具链执行(尽管我有适当的“PlatformToolset”设置)。

综上所述:

  1. 你需要有正确的“PlatformToolset”设置在你的项目,并在你的所有库项目相同设置这取决于
  2. 您需要确保正确的库目录用于,通过检查$ LibraryPath是否正确,除非你直接在你的项目设置中覆盖它,它将依赖于$ VCInstallDir通过Visual Studio内部自动化,所以检查该变量以及
  3. 要解决问题2,您可能必须删除Visual Studio 2010,因为它弄得一团糟,可能没有其他的了lution。