[cfe-dev] automatic include

Chris Lattner clattner at apple.com
Wed Jan 21 09:42:21 PST 2009


On Jan 21, 2009, at 9:39 AM, VanDung To wrote:

> Hello,
>
> I'm not sure if there's a way in clang to do this, however, I'd like  
> to automatically include a header file every time I compiles a  
> program.  What would be the best way to do this?  Can I do this  
> externally to the compiler or do I need to modify the compiler.

You can use the -include option, it works just like gcc:

$ echo "typedef int x;" > t.h
$ echo "x y;" > t.c
$ clang t.c -include t.h -I.

>
> Also, I'd like to have my header files precompiled. Where can I find  
> the documentation on how to do this.

PCH is still under active development, the command line options are  
the same as those used by gcc.

-Chris



More information about the cfe-dev mailing list