[cfe-dev] Can clangtool handle "-I"?

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 4 03:12:15 PDT 2020

On 04/08/2020 09:23, Yafei Liu via cfe-dev wrote:
> I'm writing a tool using AST matcher, and I need to pass the path of the 
> clang built-in heads to my tool (or it will error me that "'stddef.h' 
> file not found"), so I add `-I/path/to/the/headers` to my tool, but the 
> program said that "Unknown command line argument 
> '-I/usr/lib/llvm-6.0/lib/clang/6.0.0/include'."

-I/usr/lib/llvm-6.0/lib/clang/6.0.0/include is not a command-line 
argument, it is two:

"-I" and "/usr/lib/llvm-6.0/lib/clang/6.0.0/include"

I believe it should work if you pass it as the two arguments.  The shell 
will normally do this splitting for you.


More information about the cfe-dev mailing list