2013-12-17 76 views
16

我们在使用Visual Studio 2012的Windows 7 64位下使用CMake(v2.8.12)编译项目时遇到了问题.CMake为我们提供了以下错误。我们已经尝试使用管理员权限从Visual Studio命令行启动Cmake。似乎一直在CMake的2.8.11类似的bug:http://www.cmake.org/Bug/view.php?id=14440CXX编译器标识未知

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process): 
    execute_process given COMMAND argument with no value. 
Call Stack (most recent call first): 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR) 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID) 
    CMakeLists.txt:2 (project) 


The C compiler identification is unknown 
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process): 
    execute_process given COMMAND argument with no value. 
Call Stack (most recent call first): 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR) 
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID) 
    CMakeLists.txt:2 (project) 


The CXX compiler identification is unknown 
Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) 
CMake Warning at src/CMakeLists.txt:44 (message): 
    SWIG was not found. You will not be able to compile for C#. 


Configuring incomplete, errors occurred! 
See also "C:/Users/hci/laser_control/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/hci/laser_control/CMakeFiles/CMakeError.log". 
+0

那么错误信息很清楚。它不知道你的编译器ID字符串。这是否正在运行,或者您只是在移植项目?编辑相应的文件以添加此编译器。 – RedX

+2

你使用了正确的发电机吗?我的意思是“Visual Studio 11是Visual Studio 2012的正确生成器”不要将Visual Studio 12用作生成器。 – drescherjm

回答

10

我有同样的问题,并固定它的cmake运行以管理员

+10

没有帮助我的情况。 – BartoszKP

+0

使用Visual C++ 2013编译器编译SFML 2.1时遇到了同样的问题。以管理员身份运行固定它。 – sjaustirni

+0

将Windows SDK从7.0a升级到7.1后,我遇到了同样的问题。新版本被放入C:\ Program Files \(我猜我拿了64位版本),VS2012 C++和CMake也无法编译。运行Windows控制面板|程序和函数| VS2012 |修复做了诀窍,现在VS和CMake正常运行。 – Michbeckable

0
这里的cmake 2.8.12和Visual Studio 10

同样的问题。Cmake可能无法找到编译器。我通过卸载最新版本并安装了cmake 2.8.10解决了这个问题。

0

我只是这个问题遇到,在我卸载一些MS软件。 我通过维修视觉工作室2012修复了它。 首先进入[控制面板],然后选择视觉工作室并修复它,事情就会马上进行。

0

确保您选择了正确版本的Visual Studio。 例如,Visual Studio 2012是版本11.

0

我有同样的问题,我不得不使用"File -> Delete Cache",因为我意外地配置CMake使用错误的视觉工作室版本。

0

如果您使用CMake 3.4.0,请尝试升级到更新的版本。有关这方面的错误最近得到修复(请参阅bug report)。

2

这些错误消息

The C compiler identification is unknown 
The CXX compiler identification is unknown 

意味着CMake的确实发现或承担一个编译器,但它不能够编译一个简单的测试程序。

看看CMakeFiles\CMakeError.log并检查错误消息那里看看:

  1. 该编译器的路径/命令行的CMake并使用
  2. 什么错误信息调用编译器是

    例如LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

如果添加--debug-trycompilecmake呼叫CMake的甚至会保持它一直试图测试编译的文件(这样你就可以复制/粘贴/重新运行在错误日志命令行中,你cmd壳)。

上一次我遇到这个问题...

我最后一次遇到此问题时,我的Visual Studio 2012 Professional标准安装没有安装任何Windows SDK(错误日志显示缺少SDK标头)。

要验证您的SDK安装,例如检查您是否安装了任何资源编译器。它应该是类似的路径:

C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe 

因为我错过了这一点 - 或者更准确的任何SDK - 我安装Windows 8.1 SDK(因为的Visual Studio 2012做目标Windows 8.x中),瞧我的CMake能够再次编译(测试)程序。

参考

0

我面临同样的问题。从Visual Studio构建和运行项目对我来说不起作用。但以下工作对我来说:

  • 从Visual Studio工具打开命令提示符的开发人员。
  • 转至cmake.exe所在的目录。
  • 运行它。

让我们希望它也适合您。

相关问题