如何在gcc或clang中的c ++ 20(启用模块)中包含多个预编译标头 [英] How to include multiple precompiled headers in with c++20 (with modules enabled) in gcc or clang

查看:125
本文介绍了如何在gcc或clang中的c ++ 20(启用模块)中包含多个预编译标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c ++ 20中,启用模块时,应该将每个include封装起来,以便顺序无关紧要,并且宏不会泄漏等.

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.

显然问题 if 是否可以预编译多个标头是

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

我现在的问题是:如何您如何做到这一点:即:我如何首先预编译一组头文件,然后使编译器将它们(全部)识别为我的预编译头文件使用c ++ 20模块的翻译单元(使用linux命令行).

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).

我想为g ++提供解决方案,但如果只有clang可行,那答案就可以了.

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

注意问题已经过时了.

推荐答案

如何在gcc中包括多个预编译的标头...

How to include multiple precompiled headers ... in gcc

没有办法.如文档所述:

There is no way. As the documentation says:

在特定的编译中只能使用一个预编译头.


(已启用模块)在gcc中

(with modules enabled) in gcc

在撰写本文时,尚无GCC发行版支持模块.

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

在某种程度上还不清楚如何包括预编译的头文件".与模块完全相关,但是我猜您可能会对使用预建模块"感兴趣Clang文档的一部分.

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.

这篇关于如何在gcc或clang中的c ++ 20(启用模块)中包含多个预编译标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆