[cfe-dev] automatic include

VanDung To vandungto at gmail.com
Wed Jan 21 09:52:40 PST 2009


Thank you,

I found the code to do that.

On Wed, Jan 21, 2009 at 11:50 AM, Chris Lattner <clattner at apple.com> wrote:

>
> On Jan 21, 2009, at 9:48 AM, VanDung To wrote:
>
> Thanks for the quick response.
>
> I'm not looking for a compile time option (-include -I).   In the
> environment I'm looking at, it is very awkward to force the user to specify
> the include file every time. Is there a way for clang to do this without
> using the compile time option?   I'm willing to modify/hack some code.
>
>
> Sure, the "-include" option just adds a #include to the predefines buffer.
>  If you look at how -include is implemented, you can see this in action and
> do something similar.
>
> -Chris
>
>
>
> Sincerely,
>
> On Wed, Jan 21, 2009 at 11:42 AM, Chris Lattner <clattner at apple.com>wrote:
>
>>
>> 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
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090121/ad231771/attachment.html>


More information about the cfe-dev mailing list