Please help with using Clang

I'm running Cygwin and downloaded the llvm/clang package from them. In the cache I set the compiler to use clang, but as soon as I build something it reverts to gcc/c++ compiler. How can I use and keep the clang compilers?

3 comments
Comment actions Permalink

Hi!

Could you please try to use method #2 from http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F pass
-D CMAKE_C_COMPILER=<your_path_to_c_compiler>  -D CMAKE_CXX_COMPILER=<your_path_to_cxx_compiler>
to Settings | Build, Execution, Deployment | CMake | CMake options.
Then corresponding CMake cache variables will be overwritten respectively. Does that help?
0
Comment actions Permalink

I get the following errors on all my c++ projects:

collect2: error: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)

This is what I have for cmake options:

-D CMAKE_C_COMPILER=clang C:/cygwin64/bin -D CMAKE_CXX_COMPILER=clang++  C:/cygwin64/bin

Also, can I make clang the default compiler? I have to type this in every project otherwise.

Thanks.

0
Comment actions Permalink

The short answer is you need to install GCC additionally to have linker etc, cause clang represents only compiler itself. Good explanaition of the whole situation with toolchains for Windows can be found here.

0

Please sign in to leave a comment.