the question is how could I distribute my library as module without tie to specific build system? Get Outlook for Android<https://aka.ms/AAb9ysg> ________________________________ From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx> Sent: Thursday, August 24, 2023 7:25:48 AM To: sotrdg sotrdg <euloanty@xxxxxxxx> Cc: gcc-help@xxxxxxxxxxx <gcc-help@xxxxxxxxxxx> Subject: Re: why does C++ module header unit need to precompiled with build system instead of build automatically with compiler? On Wed, 23 Aug 2023 at 23:05, sotrdg sotrdg via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > I just wonder why do i need to precompile header unit as C++ modules?why not do it automatically with gcc?i am not talking about import module;i am talking about import "header.h"; Because the compiler header unit depends on your compilation flags, such as -std and optimization level, and macros such as -D_GLIBCXX_ASSERTIONS. If GCC provided those precompiled then it would have to provide multiple copies of every header unit compiled with various options, and then gcc would need to be taught how to find the right one for the right set of options. Modules (including module header units) are not intended to be distributed in binary form. The expected usage model is that you compile them with your own preferred options in a location where your own builds can find them.