我在使用 Visual Studio 2010 在 Windows 7 下使用 cmake-gui (cmake-2.8.8-win32-x86) 构建 ITK 库 (InsightToolkit-4.1.0) 时遇到问题,如下所述: https ://itk.org/维基/ITK/Configuring_and_Building/VisualStudio。我已经逐步完成了所有工作,但我不明白问题出在哪里,我使用默认的本机编译器指定了 Visual Studio 10 生成器并得到了这些错误。
Check for working C compiler using: Visual Studio 10
Check for working C compiler using: Visual Studio 10 -- broken
**CMake Error at C:/ITK/CMake/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "cl" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/ITK/Build/CMakeFiles/CMakeTmp
Run Build Command:C:\PROGRA~2\MICROS~2.0\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec1875248370
Microsoft (R) Visual Studio Version 10.0.30319.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: cmTryCompileExec1875248370, Configuration:
Debug Win32 ------
1> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
for 80x86
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D
"CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise
/Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec1875248370.dir\Debug\\"
/Fd"C:/ITK/Build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec1875248370.pdb"
/Gd /TC /analyze- /errorReport:prompt
C:\ITK\Build\CMakeFiles\CMakeTmp\testCCompiler.c /Zm1000
1>
1> testCCompiler.c
1>LINK : fatal error LNK1123: failure during conversion to COFF: file
invalid or corrupt
========== 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!