use*_*931 18 c++ cmake visual-studio-2012
我们在使用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
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".
Run Code Online (Sandbox Code Playgroud)
Flo*_*ian 10
那些错误信息
The C compiler identification is unknown
The CXX compiler identification is unknown
Run Code Online (Sandbox Code Playgroud)
意味着 CMake 确实找到或假设了一个编译器,但它无法编译一个简单的测试程序。
查看CMakeFiles\CMakeError.log并检查那里的错误消息以查看:
调用编译器的错误信息是什么
例如 LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'
如果您添加--debug-trycompile到cmake调用中,CMake 甚至会保留它尝试测试编译的文件(因此您可以从cmdshell的错误日志中复制/粘贴/重新运行命令行)。
上次遇到这个问题...
我最后一次遇到这个问题是我的 Visual Studio 2012 Professional 标准安装没有安装任何 Windows SDK(错误日志显示缺少 SDK 标头)。
验证您的 SDK 安装,例如检查您是否安装了任何资源编译器。它应该位于类似于以下内容的路径中:
C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe
Run Code Online (Sandbox Code Playgroud)
由于我错过了这个 - 或者更准确的任何 SDK - 我安装了Windows 8.1 SDK(因为 Visual Studio 2012 确实针对 Windows 8.x),瞧,我的 CMake 能够再次编译(测试)程序。
参考
Kim*_*m T 10
我得到终端输出:
The C compiler identification is unknown
The CXX compiler identification is unknown
Run Code Online (Sandbox Code Playgroud)
我检查了 CMakeError.log 输出:
\build\CMakeFiles\CMakeError.log
Run Code Online (Sandbox Code Playgroud)
它显示了错误:
warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
Run Code Online (Sandbox Code Playgroud)
回到 Visual Studio,我需要安装 Windows 10 SDK:
安装 SDK 并运行 cmake 后显示:
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
The C compiler identification is MSVC 19.28.29334.0
The CXX compiler identification is MSVC 19.28.29334.0
Run Code Online (Sandbox Code Playgroud)
并搭建成功!
| 归档时间: |
|
| 查看次数: |
57602 次 |
| 最近记录: |