Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I setup a Clang Toolchain in Eclipse on Windows?

I am apologizing for a stupid question. But I could not find the answer on the Internet. I'm struggling to set up Clang compiler/linker/... for Eclipse in Windows 7 on a 64 bit machine. I have very outdated knowledge of C++ and never worked in Eclipse. What I am trying to achieve is to compile a simpliest hello world application using Clang under Eclipse on a Windows 7 x64 machine.

I've managed to follow the instruction at http://clang.llvm.org/get_started.html on getting and building LVVM + Clang. I installed the Eclipse plugin as described at http://marketplace.eclipse.org/content/llvm-toolchain-eclipse-cdt. I set the PATH environment variable to the c:\lvvm\debug\bin; that contains the built executables.

Now, how do I switch the Eclipse to use LVVM? Particularly what do I put to:

  • include directories
  • libraries
  • serarch path

in the following dialog?

enter image description here

Also I found the following dialog in preferences of a project:

enter image description here

It is completely unclear what I should make it look like.

Thank you for your help! Sorry for the nooby question, I am a C# developer trying to get back to C++.

like image 584
Trident D'Gao Avatar asked Jun 10 '12 23:06

Trident D'Gao


People also ask

Is Clang a toolchain?

Introduction. Clang is only one component in a complete tool chain for C family programming languages. In order to assemble a complete toolchain, additional tools and runtime libraries are required.

Where is Clang installed Windows?

Use the default install location: C:\Program Files (x86)\LLVM and complete the installation. clang++.exe should be located in C:\Program Files (x86)\LLVM\bin , but should NOT be in your system path.


1 Answers

For what it's worth, I just had to do this today, and I found all I had to do was change

project -> properties -> c/c++ build -> settings -> tool settings -> gcc c++ compiler -> command: change it from g++ to clang++

and similarly

project -> properties -> c/c++ build -> settings -> tool settings -> gcc c compiler -> command: change it from gcc to clang

As for the indexer, I found this helped....

Eclipse CDT indexer does not know C++11 containers

Although that's more of a c++11 thing than a clang thing, but I needed both.

like image 175
stu Avatar answered Sep 30 '22 03:09

stu