https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99072
--- Comment #4 from Boris Kolpackov <boris at kolpackov dot net> --- You need to use different .ii file names on the first and second header unit builds. Using your original command lines as a reference: # first build of header-unit devvm1702:45>./xg++ [...] -o 99072_a.ii 99072_a.H devvm1702:46>./xg++ [...] -c 99072_a.ii # second build of string devvm1702:45>./xg++ [...] -o 99072_a.so.ii 99072_a.H devvm1702:46>./xg++ [...] -c 99072_a.so.ii