Nitin Mukesh Tiwari
2014-Oct-25 01:55 UTC
[LLVMdev] Query regarding LLVM library for compilation
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141025/c8935a92/attachment.html>
On Sat, Oct 25, 2014 at 01:55:44AM +0000, 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 ?The tool llvm-config [1] might solve your problem, it will give you the correct compiler and linker flags. Just make sure the llvm-config you invoked is the right one. HTH, chenwj [1] http://llvm.org/docs/CommandGuide/llvm-config.html -- Wei-Ren Chen (陳韋任) Homepage: http://people.cs.nctu.edu.tw/~chenwj
John Criswell
2014-Oct-27 13:53 UTC
[LLVMdev] Query regarding LLVM library for compilation
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>