我们在使用 Visual Studio 2012 的 Windows 7 64Bit 下使用 CMake (v2.8.12) 编译项目时遇到问题.CMake 给我们以下错误.我们已经尝试使用管理员权限从 Visual Studio 命令行启动 Cmake.CMake 2.8.11 中似乎有一个类似的错误:http://www.cmake.org/Bug/view.php?id=14440
We are having trouble compiling a project using CMake (v2.8.12) under Windows 7 64Bit using Visual Studio 2012. CMake gives us the following errors. We already tried starting Cmake from the Visual Studio Command Line using admin rights. There seems to have been a similar bug in CMake 2.8.11: http://www.cmake.org/Bug/view.php?id=14440
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".
那些错误信息
The C compiler identification is unknown
The CXX compiler identification is unknown
表示 CMake 确实找到或假设了一个编译器,但它无法编译一个简单的测试程序.
means CMake did find or assume a compiler but it wasn't able to compile a simple test program.
查看 CMakeFilesCMakeError.log
并检查那里的错误消息以查看:
Take a look at CMakeFilesCMakeError.log
and check the error message there to see:
调用编译器的错误信息是什么
what the error message calling the compiler was
例如LINK:致命错误 LNK1181:无法打开输入文件 'kernel32.lib'
如果您将 --debug-trycompile
添加到 cmake
调用中,CMake 甚至会保留它尝试测试编译的文件(因此您可以复制/粘贴/重新- 从 cmd
shell 中的错误日志运行命令行).
If you add --debug-trycompile
to the cmake
call CMake will even keep the files it has tried to test compile (so you can copy/paste/re-run the command line from the error log in your cmd
shell).
我上次遇到这个问题......
我上次遇到这个问题是在我的 Visual Studio 2012 Professional 标准安装中没有安装任何 Windows SDK(错误日志显示缺少 SDK 标头).
The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).
验证您的 SDK 安装,例如检查您是否安装了任何资源编译器.它应该位于类似于以下内容的路径中:
To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:
C:Program Files (x86)Microsoft SDKsWindowsv[some version]inRC.Exe
因为我错过了这个 - 或者更准确的任何 SDK - 我安装了 Windows 8.1 SDK(因为 Visual Studio 2012 确实针对 Windows 8.x),瞧,我的 CMake 再次能够编译(测试)程序.
Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs.
参考
这篇关于CXX 编译器标识未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!