gdc 12.1: undefined references when linking separately compiled files

Steven Schveighoffer schveiguy at gmail.com
Sat May 28 15:10:25 UTC 2022


On 5/28/22 10:44 AM, Adam D Ruppe wrote:
> 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.

It should only think that if it sees it instantiated.

If it's instatiated in std, it should be included in the built phobos 
library. If it's not instantiated in std, then the compiler should be 
putting it inside the object file.

Is this specific to gdc, or does it happen for other compilers as well?

-Steve


More information about the Digitalmars-d-learn mailing list