On Fri, 5 May 2023 at 06:09, Wilhelm Meier wrote: > > Hi all, > > I think, I have some misconceptions about compiling modules :-( > > Say, I have a module interface unit modA.hxx and a module implementation > unit modA.cxx for module A. If I compile modA.hxx I get the bmi in > gcm.cache and a file modA.o. I need the bmi to compile the modA.cxx, but > this overrides modA.o. This does not harm, since modA.o from modA.hxx > looks more or less empty. Linking with the (overridden) file modA.o does > work. A module interface unit is not a header, so there's no reason to use a .hxx extension. So if you name them something like modA_intf.cxx and modA_impl.cxx then you avoid the problem. You can also use -fmodule-only to inhibit creation of the .o file (GCC doesn't know whether you intend to compile a module interface unit or a module implementation unit, so it treats them the same and assumes you want a linkable .o file).