[LLVMdev] Query regarding LLVM library for compilation

John Criswell jtcriswel at gmail.com
Mon Oct 27 06:53:50 PDT 2014


Dear Nitin,

The LLVM and Clang header files #include other LLVM and Clang header 
files.  Therefore, when compiling your code with gcc or clang, you need 
to add the -I option to tell the compiler where to find these header 
files.  The -I option can be used multiple times to specify multiple 
locations for which to look for header files.

For example, if a header file is located in /u/criswell/foo/bar.h, then 
adding -I/u/criswell to the gcc/clang command line will allow me to use 
#include <foo/bar.h> in my source code.

The reason why your code compiles when added to the LLVM/Clang source 
trees is that the LLVM Makefiles add the appropriate -I options for you.

Regards,

John Criswell

On 10/24/14, 9:55 PM, Nitin Mukesh Tiwari wrote:
> Dear LLVM Team
>
> I have installed LLVM and have also tried of using examples for 
> learning LLVM.
> I am really sorry if this is a silly question but I tried writing one 
> file for clang++ which uses some header file from LLVm nad clang like 
> verifier.h.
> I could not compile as the error was thrown that verifier.h not found 
> even when I have the exact path. But when I put my file in example 
> folder and made changes to makefile and build the examples by running 
> make file everything just worked fine. My query is is ther any way 
> that my system automatically finds the header for LLVm and clang 
> whenever I use them like it does for stdio.h and iostream.h or I need 
> to build the example again and again ?
>
> Thanks and Regards
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141027/4d31e357/attachment.html>


More information about the llvm-dev mailing list