I am building a C++ project with Clang 3.8 and CMake 3.7 on Windows, but Clang emits an error in configure like below.
Determining if the CXX compiler works failed with the following output: Change Dir: C:/tools/k.build/CMakeFiles/CMakeTmp Run Build Command:"C:/tools/ninja.exe" "cmTC_c0004" [1/2] Building CXX object CMakeFiles/cmTC_c0004.dir/testCXXCompiler.cxx.obj [2/2] Linking CXX executable cmTC_c0004.exe FAILED: cmTC_c0004.exe cmd.exe /C "cd . && C:\tools\llvm-3.8.1.build\Release\bin\clang++.exe CMakeFiles/cmTC_c0004.dir/testCXXCompiler.cxx.obj -o cmTC_c0004.exe -Wl,--out-implib,libcmTC_c0004.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ." LINK : warning LNK4044: unrecognized option '/-out-implib'; ignored LINK : warning LNK4044: unrecognized option '/-major-image-version'; ignored LINK : warning LNK4044: unrecognized option '/-minor-image-version'; ignored LINK : fatal error LNK1181: cannot open input file 'libcmTC_c0004.dll.a' clang++.exe: error: linker command failed with exit code 1181 (use -v to see invocation) ninja: build stopped: subcommand failed.
Strange thing is that no file exists in CMakeFiles/CMakeTmp/. How can I get it to work?
k.build
and try from scratch again? Looks like you switched compilers e.g. fromgcc
toclang
in the same output directory. You could also try a minimal example like here. – Florian/-
are plain wrong, and.dll.a
looks strange, too. How do you invoke CMake? What compiler does it detect? – usr1234567CMAKE_CXX_COMPILER_ID=Clang
andCMAKE_CXX_COMPILER=path-to-clang++
.CMakeLists.txt
has originally been written for Linux and g++. Should it be modified for Windows? – HenryK