lipengcheng
2014-Jun-06 15:56 UTC
[LLVMdev] stdio.h cannot be found using Clang as a library
Hi there, I am now trying to use Clang as a library to analyze C/C++ programs. I encountered a problem when dealing with header files. As you know, using clang needs my own consumer, action stuffs. And it calls ParseAST function automatically during execution of my actions. Now the problem happens when doing ParseAST. ParseAST cannot find out the header file of "stdio.h", actually all header files except the ones in the current directory. Any solutions about this ? Thanks, Say, we have a program as follows. After removing the header file declaration, it works. #include <stdio.h> main() { int a; a = a + 1; } Best, - Pengcheng
lipengcheng
2014-Jun-06 16:04 UTC
[LLVMdev] stdio.h cannot be found using Clang as a library
So that means how can I pass my default C_INCLUDE_PATH, LD_LIBRARY_PATH search paths to Clang inside ? Thanks, On Jun 6, 2014, at 11:56 AM, lipengcheng <pli at cs.rochester.edu> wrote:> Hi there, > > I am now trying to use Clang as a library to analyze C/C++ programs. > I encountered a problem when dealing with header files. > > As you know, using clang needs my own consumer, action stuffs. And > it calls ParseAST function automatically during execution of my actions. Now the > problem happens when doing ParseAST. ParseAST cannot find out > the header file of "stdio.h", actually all header files except the ones in the > current directory. > > Any solutions about this ? Thanks, > > Say, we have a program as follows. After removing the header file declaration, > it works. > > #include <stdio.h> > main() > { > int a; > a = a + 1; > } > > Best, > - Pengcheng