<div dir="ltr">No, this doesn't work, at least with 3.1.<div><br></div><div style>Search headerSearch or headerSearchOptions in this mailing list, there are a lot of similar threads.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 9, 2013 at 10:43 AM, Robert Ankeney <span dir="ltr"><<a href="mailto:rrankene@gmail.com" target="_blank">rrankene@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Something like:<br>HeaderSearchOptions &headerSearchOptions = theCompInst->getHeaderSearchOpts();<br>headerSearchOptions.AddPath("D:/test/include", clang::frontend::Angled, false, false, false);<br><br>should do it.<div class="HOEnZb">
<div class="h5"><br>
<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
I'm writing a tools (do some static check) using clang lib . This is my code:<br>
<br>
void main()<br>
{<br>
    DiagnosticOptions diagnosticOptions;<br>
    TextDiagnosticPrinter *printer = new<br>
TextDiagnosticPrinter(llvm::nulls(),<br>
        diagnosticOptions);<br>
    llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs;<br>
    DiagnosticsEngine diagnostics(diagIDs, printer);<br>
    LangOptions langOpts;<br>
<br>
    TargetOptions targetOpts;<br>
    targetOpts.Triple = llvm::sys::getDefaultTargetTriple();<br>
    TargetInfo *pti = TargetInfo::CreateTargetInfo(diagnostics, targetOpts);<br>
    FileSystemOptions fsopts;<br>
    FileManager fileManager(fsopts);<br>
    SourceManager sourceManager(diagnostics, fileManager);<br>
<br>
    HeaderSearch headerSearch(fileManager, diagnostics, langOpts, pti);<br>
<br>
    CompilerInstance *theCompInst = new CompilerInstance();<br>
    theCompInst->setDiagnostics(&diagnostics);<br>
    Preprocessor *pp = new Preprocessor(diagnostics, langOpts,<br>
pti,sourceManager, headerSearch, *theCompInst);<br>
<br>
    const FileEntry *pFile = fileManager.getFile(file_name);<br>
    sourceManager.createMainFileID(pFile);<br>
<br>
theCompInst->getDiagnosticClient().BeginSourceFile(theCompInst->getLangOpts(),pp);<br>
    theCompInst->setPreprocessor(pp);<br>
    theCompInst->setSourceManager(&sourceManager);<br>
    theCompInst->setTarget(pti);<br>
    theCompInst->setDiagnostics(&diagnostics);<br>
    SourceManager &sourceMgr = theCompInst->getSourceManager();<br>
    theCompInst->createASTContext();<br>
    Rewriter rewriter;<br>
    rewriter.setSourceMgr(sourceMgr,langOpts);<br>
<br>
<br>
    MyASTConsumer consumer(rewriter);<br>
    ParseAST(theCompInst->getPreprocessor(), &consumer,<br>
theCompInst->getASTContext());<br>
    theCompInst->getDiagnosticClient().EndSourceFile();<br>
}<br>
<br>
I want to check some C/C++ code using this tools. But *.h file and *.c file<br>
is not in the same filefold.<br>
<br>
Example:<br>
  test.c context:<br>
    #include "test.h"<br>
     .........<br>
<br>
test.c in D:\test\test.c<br>
test.h in D:\test\include\test.h<br>
<br>
So I need to add "D:\test\include" to the header search path. How to do that<br>
in my code?<br>
Thanks all!<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/How-to-add-custom-include-dir-to-the-header-search-path-tp4031389.html" target="_blank">http://clang-developers.42468.n3.nabble.com/How-to-add-custom-include-dir-to-the-header-search-path-tp4031389.html</a><br>


Sent from the Clang Developers mailing list archive at Nabble.com.<br>
<br></blockquote></div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Welson<div><br></div><div>Phone: (408) 418-8385</div><div>Email:  <a href="mailto:welson.sun@gmail.com" target="_blank">welson.sun@gmail.com</a></div><div>
<br></div>
</div>