我正在Windows上使用Clang 3.8和CMake 3.7构建一个C ++项目,但Clang在 configure 中发出错误,如下所示。
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.
奇怪的是CMakeFiles / CMakeTmp /中不存在任何文件。我怎样才能让它发挥作用?
答案 0 :(得分:0)
简而言之,您定义的工具链是错误的。 CMake认为您正在使用具有不同路径的MSVC编译器。有关详细解答,请参阅this question。请注意,您仍然需要MSVC或Cygwin作为构建环境。