[cfe-dev] clang -include option

don hinton via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 13 14:37:33 PST 2016


Hi Vasily:

You can only include one precompiled header per compilation, so the second
-include should just include the regular header, but since you changed the
path, clang couldn't find it.

Pretty sure clang pch works just like gcc, so here's the gcc page which
gives a lot more detail:

  https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html

hth...
don

On Mon, Dec 12, 2016 at 9:21 AM, Vasily Romanikhin via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello all,
>
> I have a question about *-include* option.
> Imagine that I have *main.c* which depends on *mylib1.h* and *mylib2.h*
>
> I can easily compile it using the follow command:
> clang -include lib/mylib1.h -include lib/mylib2.h main.c -o
>
>
> But if I precompile two header: *pch**/mylib1.h.pch* and pch*/mylib2.h.pch
> *and try to use with -*include* option, it doesn't work:
> clang -include pch/mylib1.h -include pch/mylib2.h main.c -o
> <built-in>:1:10: fatal error: 'mylib2.h' file not found
> #include "mylib2.h"
>          ^
> 1 error generated.
>
>
> Please note that the same works fine for one precompiled header.
> Could anybody explain me that behaviour.
>
> Thanks an advance,
> Vasily
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161213/485cb7e7/attachment.html>


More information about the cfe-dev mailing list