the same errors are still there. But when I use -lCIndex instead of -lclangBasic(etc.),  it links successfully. Another error appears when it comes to running the executable(by ./Myfile). <div>error like this:</div><div>error while loading shared libraries: libCIndex.so: cannot open shared object file: No such file or directory</div>

<div><br><br><div class="gmail_quote">On Wed, May 19, 2010 at 9:22 AM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div style="word-wrap:break-word"><div class="im"><br><div><div>On May 18, 2010, at 6:19 PM, Jiandong Wang wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">On Tue, May 18, 2010 at 10:11 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word"><div><div></div><div><br><div><div>On May 18, 2010, at 6:09 AM, Jiandong Wang wrote:</div><br><blockquote type="cite">Hi all:<div>    now I am trying to run my own ASTConsumer against AST, but not quite sure how to do it, especially how to get an object or pointer of ASTContext. BTW, ASTContext is required by ParseAST.  </div>



<div>here is my code snippet:</div>

<div><br></div></blockquote></div></div></div><div>You can just create an ASTContext on the stack, passing in the various other pieces (lang options, source manager, target info, etc.) when you construct it.</div></div></blockquote>



<div> </div><div> Thank you. I finally compiled it through.my command:</div><div>       g++ `llvm-config --cxxflags --ldflags` -fno-rtti -c Myfile.cpp -o Myfile.o</div><div>but when I generated the executable, unexpected errors occured. my command:</div>



<div>       g++ `llvm-config --cxxflasg --ldflags --libs core` -o Myfile Myfile.o </div><div><br></div><div>errors like this:</div><div>undefined reference to 'llvm::errs()'</div><div>undefined reference to 'clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'</div>



<div>undefined reference to 'clang::FileManager::FileManager()'</div><div><br></div><div>missing something? </div></div>
</blockquote><br></div></div><div>You need to link against the Clang libraries. -lClangBasic -lClang -lClangAST and so on.</div><div><br></div><div><span style="white-space:pre">  </span>- Doug</div><br></div></blockquote>

</div><br></div>