cmake编译ITK报错:The C compiler is not able to compile a simple test program

cmake编译ITK时出现如下错误:

The C compiler identification is MSVC 19.0.23026.0

Check for working C compiler: E:/Microsoft Visual Studio 14.0/VC/bin/cl.exe

Check for working C compiler: E:/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken

CMake Error at E:/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "E:/Microsoft Visual Studio 14.0/VC/bin/cl.exe" is not able
to compile a simple test program.

检查出错信息,发现:

LINK : fatal error LNK1104: 无法打开文件“MSVCRTD.lib”

打开VS2015,任选了一个工程,打开“属性管理器”->Debug|Win32->Microsoft.Cpp.Win32.user,"链接器"->"输入"->"附加依赖项"中有msvcrtd.lib,而"链接器"->"常规"->"附加库目录"中没有msvcrtd.lib的路径。遂添加msvcrtd.lib路径“$(VC_LibraryPath_x86)”,保存并退出VS2015,再用cmake编译ITK,就不再报错了。


你可能感兴趣的:(ITK)