gdc 12.1: undefined references when linking separately compiled files
Alexibu
alex at sunopti.com
Thu Jul 6 22:44:27 UTC 2023
On Saturday, 28 May 2022 at 14:44:56 UTC, 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.
>
> 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.
I just encountered this problem in recently released debian
bookworm (gdc 12.2.0), I was able to fix these undefined lambdas
inside std library with -fall-instantiations, and a bunch of
other undefined lambdas in my own code by changing template
arguments of the form
alias e = (a => a)
to a separate definition
auto (T)default_e(T a)
{
return a;
}
and
alias e = default_e
More information about the Digitalmars-d-learn
mailing list