2013-01-14 46 views
6

我正在嘗試讓CMAKE爲msvc 10快速版x64體系結構創建一個項目。我安裝了MSVC 2010 Express和Windows SDK 7.1。Cmake無法爲Visual Studio 10配置項目amd64

如果我啓動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! 

回答

1

我對Win7的類似問題,並得到同樣的錯誤 - C編譯器「cl.exe時」不能夠編譯一個簡單的測試程序。

爲我工作的解決方案:

  1. 在Windows DONOT運行cmake cygwin的終端上。
  2. 從命令提示符運行它,並確保您擁有管理員權限, 在Windows 7中,您可以以管理員身份啓動命令提示符,方法是前往 開始 - >所有程序 - >附件 - >(右鍵單擊命令提示符),並選擇「以管理員身份運行」

然後運行cmake <your source> 工作就像對我的魅力。

相關問題