使用cmake时出现奇怪的错误
有谁知道“C 编译器“cl”无法编译简单的测试程序”。意思是?
我正在尝试在 MSVC 9 上使用 CMake 编译 Wt。
操作系统是Windows XP。
这是完整的日志:
检查 C 编译器是否正常工作:cl Check 对于工作 C 编译器: cl -- 损坏 CMake 错误位于 I:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (消息):C 编译器“cl”是 无法编译简单的测试 程序。
失败并显示以下输出:
更改目录: 我:/SophisPal/build/CMakeFiles/CMakeTmp
运行构建 命令:C:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe CMAKE_TRY_COMPILE.sln /build 调试 /项目 cmTryCompileExec
Microsoft (R) Visual C++ Express 版本版本9.0.30729.1。
版权所有 (C) Microsoft Corp 2007。 保留所有权利。
1>------ 构建已开始: 项目: cmTryCompileExec,配置:调试 Win32 ------
1>正在编译...
1>Microsoft (R) 32 位 C/C++ 优化编译器版本 80x86 为 15.00.30729.01
1>版权所有 (C) Microsoft 公司。保留所有权利。
1>cl /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "CMAKE_INTDIR=\"调试\""
/D "_MBCS" /FD /RTCs /MDd /Fo"cmTryCompileExec.dir\Debug\"
/Fd"I:/SophisPal/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec.pdb" /W3 /c /Zi /TC /Zm10001> .\testCCompiler.c
1>testCCompiler.c
1>正在将清单编译为资源...
1>Microsoft (R) Windows (R) 资源 编译器版本6.1.6723.1
1>版权所有 (C) Microsoft 公司。保留所有权利。
1>正在链接...
1>嵌入清单...
1>项目:错误 PRJ0003:错误 生成“cmd.exe”。
1>构建日志保存在
“文件://i:\SophisPal\build\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm”1>cmTryCompileExec - 1 个错误,0 警告
========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========
CMake 将无法正确 生成这个项目。调用栈 (首先是最近的通话):
CMakeLists.txt:7(项目)配置不完整,错误 发生了!
Does anyone know what "The C compiler "cl" is not able to compile a simple test program." means?
I am trying to compile Wt using CMake on MSVC 9.
The OS is Windows XP.
Here is the full log:
Check for working C compiler: cl Check
for working C compiler: cl -- broken
CMake Error at I:/Program Files/CMake
2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50
(MESSAGE): The C compiler "cl" is
not able to compile a simple test
program.It fails with the following output:
Change Dir:
I:/SophisPal/build/CMakeFiles/CMakeTmpRun Build
Command:C:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe
CMAKE_TRY_COMPILE.sln /build Debug
/project cmTryCompileExecMicrosoft (R) Visual C++ Express
Edition Version 9.0.30729.1.Copyright (C) Microsoft Corp 2007.
All rights reserved.1>------ Build started: Project:
cmTryCompileExec, Configuration: Debug
Win32 ------1>Compiling...
1>Microsoft (R) 32-bit C/C++
Optimizing Compiler Version
15.00.30729.01 for 80x861>Copyright (C) Microsoft
Corporation. All rights reserved.1>cl /Od /D "WIN32" /D "_WINDOWS" /D
"_DEBUG" /D "CMAKE_INTDIR=\"Debug\""
/D "_MBCS" /FD /RTCs /MDd
/Fo"cmTryCompileExec.dir\Debug\"
/Fd"I:/SophisPal/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec.pdb"
/W3 /c /Zi /TC /Zm10001> .\testCCompiler.c
1>testCCompiler.c
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource
Compiler Version 6.1.6723.11>Copyright (C) Microsoft
Corporation. All rights reserved.1>Linking...
1>Embedding manifest...
1>Project : error PRJ0003 : Error
spawning 'cmd.exe'.1>Build log was saved at
"file://i:\SophisPal\build\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"1>cmTryCompileExec - 1 error(s), 0
warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
CMake will not be able to correctly
generate this project. Call Stack
(most recent call first):
CMakeLists.txt:7 (PROJECT)Configuring incomplete, errors
occurred!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在 google 上搜索了 cmd.exe 错误,并找到了 此页面。看起来 Visual Studio 需要配置一些路径,以便它知道如何找到 cmd.exe。以下是该线程的步骤:
I googled for the cmd.exe error and came up with this page. Looks like Visual studio needs to be configured with a few paths so it knows how to find cmd.exe. Here are the steps from that thread:
检查您安装的任何其他工具是否覆盖了 PATH 变量。就我而言,发生了这种情况,并且症状(链接错误)完全相同。
Check if any other tool that you have installed overwrote the PATH variable. In my case this happened and the symptom (link error) was the exact same.
关键行可能是:
由于某种原因,MSVC 无法执行“cmd.exe”,因此编译失败。
我猜测问题可能与%PATH%的设置有关;可能还有其他原因造成了麻烦。
尝试手动执行 CMake 所做的操作 - 看看是否出现相同的错误。这将帮助您诊断问题是出现在 CMake 中(如果它在命令行中对您有效)还是在您的一般环境中(如果它也不适合您)。
了解如何阅读错误消息!
这是输出中的两行早期内容。第一个表示 CMake 将目录更改为其创建的目录之一。第二个表示它在那里运行的命令。在运行命令之前,您还需要找出它在目录中创建的文件。
有了这些信息,您将必须执行相同的步骤 - “cd”,然后是“vcexpress”。
The key line is probably:
For some reason or another, the MSVC is not able to execute 'cmd.exe', and therefore the compilation fails.
I would guess that the problem might be related to the setting of %PATH%; there might be some other reason for the trouble.
Try doing what CMake did manually - see whether you get the same error. This will help you diagnose whether the problem is in CMake (if it does work for you from the command line) or in your general environment (if it does not work for you either).
Learn how to read error messages!
These are two of the early lines in the output. The first indicates that CMake changed directory to one of its creating. The second indicates the command it ran there. You would also need to find out what files it created in the directory before running the command.
With that information at hand, you'll have to go through the same steps - 'cd' followed by 'vcexpress'.
我在 VS 7 .NET 2003 上遇到了同样的问题。
通过添加 VC++ 目录的路径来修复
(工具菜单 > 选项 > 项目 > VC++ 目录)
问题的真正原因是:
I came across the same problem on VS 7 .NET 2003.
Fixed by adding
paths to VC++ Directories (Tools menu > Options > Projects > VC++ Directories)
Real cause of the problem is that: