6

我正在尝试让 CMAKE 为 x64 架构的 msvc 10 express edition 创建一个项目。我同时安装了 MSVC 2010 Express 和 Windows SDK 7.1。

如果我开始 CMake 通常我可以创建一个 32 位项目,但是它无法创建一个 64 位项目。我还尝试从 Windows SDK 命令提示符(cl cmd 映射到 x64 版本)中启动 CMAKE,但是它仍然失败并出现以下问题。

Found Windows SDK v7.1: C:\Program Files\Microsoft SDKs\Windows\v7.1\
Check for working C compiler using: Visual Studio 10 Win64
Check for working C compiler using: Visual Studio 10 Win64 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (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: C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp



  Run Build Command:C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
  cmTryCompileExec1400574213.vcxproj /p:Configuration=Debug

  Microsoft (R) Build Engine Version 4.0.30319.1

  [Microsoft .NET Framework, Version 4.0.30319.296]

  Copyright (C) Microsoft Corporation 2007.  All rights reserved.



  Build started 1/14/2013 8:15:59 AM.

  Project
  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  on node 1 (default targets).

  PrepareForBuild:

    Creating directory "cmTryCompileExec1400574213.dir\Debug\".
    Creating directory "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\Debug\".

  InitializeBuildStatus:

    Creating "cmTryCompileExec1400574213.dir\Debug\cmTryCompileExec1400574213.unsuccessfulbuild" because "AlwaysCreate" was specified.

  ClCompile:

    c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec1400574213.dir\Debug\\" /Fd"C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec1400574213.pdb" /Gd /TC /errorReport:queue C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\testCCompiler.c  /Zm1000 /GZ 

  C:\Program Files
  (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5):
  error : Required file "" is missing.
  [C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]


  Done Building Project
  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  (default targets) -- FAILED.



  Build FAILED.




  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  (default target) (1) ->

  (ClCompile target) -> 

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5): error : Required file "" is missing. [C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]



      0 Warning(s)
      1 Error(s)



  Time Elapsed 00:00:00.12





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


Configuring incomplete, errors occurred!
4

2 回答 2

6

我发现我的 x64 编译器被安装 SP 1 破坏了。试试这个更新来恢复它们:

http://www.microsoft.com/en-us/download/details.aspx?id=4422

于 2013-05-24T14:21:53.327 回答
2

我在 Win7 上遇到了类似的问题,并且遇到了同样的错误 - C 编译器“cl.exe”无法编译简单的测试程序。

对我有用的解决方案:

  1. 在 Windows 上 不要在 cygwin 终端上运行 cmake。
  2. 从命令提示符运行它,并确保您具有管理员权限,在 Windows 7 中,您可以通过转到开始->所有程序->附件->(右键单击命令提示符)以管理员身份启动命令提示符并选择“运行作为管理员”

然后运行cmake <your source> 对我来说就像一个魅力。

于 2013-01-23T03:22:48.610 回答