简体   繁体   中英

How to include multiple precompiled headers in with c++20 (with modules enabled) in gcc or clang

In c++20, when enabling modules, each include is supposed to be encapsulated so that the ordering does not matter, and macros does not leak out etc.

Apparently the question if it is possible to precompile multiple headers is yes.

My question now is: How do you do this: That is: How do i first precompile a set of headers and then make the compiler recognize them (all of them) as precompiled headers for my translation unit using c++20 modules, (using linux command line).

I would like to have solution for g++ but if it is only possible with clang, that answer would be ok.

Notice that this question probably is outdated.

How to include multiple precompiled headers... in gcc

There is no way. As the documentation says:

Only one precompiled header can be used in a particular compilation.


(with modules enabled) in gcc

No released version of GCC supports modules at the moment of writing.


It is somewhat unclear how "include precompiled headers" is related to modules exactly, but I'm guessing that you may be interested in the "Using Prebuilt Modules" section of Clang documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM