How to use LibClang
After spending a lot of time trying to figure out how to use libclang in my C++ project in NetBeans, here’s the recipe that did it:
1) Install LLVM and Clang sources.
2) Build LLVM. This took about 3-4 hrs.
3) Include the library generated from clang:
- Go to Project Properties > Build > Linker.
- Add the path to libclang.so to the Libraries path using “Add Library File...” option.
- In case code editor is giving trouble, add the path to /include in the sources using Tools > Options > C/C++ > C++ Compiler > Add > <path to /include folder in llvm src>
And that is all! You’re set to use all of Clang’s functionality :)













