gdc 12.1: undefined references when linking separately compiled files

Adam D Ruppe destructionator at gmail.com
Sat May 28 14:44:56 UTC 2022


On Saturday, 28 May 2022 at 14:16:51 UTC, kdevel wrote:
> $ gdc -o ppinsta ppinsta.d parser.d

Compiling together is faster anyway this is prolly what you want 
most the time.

But I know what's going on now, it is the template emission 
thing, the compiler thinks, since it is from std, it was already 
compiled somewhere else and skips it but it isn't actually there 
so the linker errors.

Using

gdc -fall-instantiations -c parser.d

Might generate it in that parser.o getting it to link. Might need 
to be used in all builds but I *think* just here, hard to say 
without a test.


More information about the Digitalmars-d-learn mailing list