1

I am having a trouble building ITK library (InsightToolkit-4.1.0) with cmake-gui (cmake-2.8.8-win32-x86) under Windows 7 using Visual Studio 2010, as mentioned here: https://itk.org/Wiki/ITK/Configuring_and_Building/VisualStudio . I have done everything step by step but I don't understand what is the problem, I specified the visual studio 10 generator with default native compilers and got these errors.

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!
Fred Larson
  • 60,987
  • 18
  • 112
  • 174
Khaled
  • 81
  • 1
  • 14
  • Have you checked [that question](http://stackoverflow.com/questions/11187157/cmake-says-c-compiler-is-broken) (and answers to it)? It describes similar error. – Tsyvarev Apr 12 '17 at 21:38
  • Is your environment able to compile a simple project using the mentioned compiler? If yes the environment running cmake from is the reason. – Th. Thielemann Apr 13 '17 at 10:34
  • `/Fo"cmTryCompileExec1875248370.dir\Debug\\"` looks suspicious. Delete your binary output directory, possibly update to a new CMake version and try again. – Florian Apr 13 '17 at 12:15
  • @Th.Thielemann yes it works fine with a simple project. – Khaled Apr 17 '17 at 07:51
  • Don't know how but you must set the right environment for your VS. – Th. Thielemann Apr 18 '17 at 06:23
  • Sorry for responding so late. Finally I installed Windows 8.1 and built ITK with the same cmake and compiler version and it worked just fine. – Khaled Sep 01 '17 at 16:26

0 Answers0