2.096.0 linker errors

Curtis cspencer at economicmodeling.com
Mon Mar 22 23:35:09 UTC 2021


Using 2.096.0, I'm getting a number of "undefined reference" 
linker errors that I haven't been able to figure out how to 
resolve.

The first linker error is undefined reference to 
std.typecons.Typedef:
```
src/phobos/std/typecons.d:7569: error: undefined reference to 
'_D3std8typecons__T7TypedefTmVmN1VAyaa20_466c617441646472657373436f6d706f6e656e74ZQCl6__initZ'
```

The module that I am compiling/linking imports std.typecons : 
Typedef at the top of the file. I have compiled the file, run 
`strings` on the output file, and grep'd the output for the 
missing symbol reported by the linker and it is in the list of 
symbols.

The second linker error is  undefined reference to 
core.internal.SwitchError:
```
src/phobos/std/range/package.d:9752: error: undefined reference 
to '_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv'
```
This shows up anywhere I have a `final switch` in the code. Like 
the Typedef error, this symbol also shows up in the list of 
symbols.

The third linker error I'm getting is undefined reference to a 
function that is defined in the module and then referenced later 
inside a class that is also defined in that module after the 
function. Again, I'm not sure why the linker would think it is 
undefined since it is defined in the same module. I did try 
moving the function definition inside the class and the linker 
errors associated with that function go away.

The code compiles and links with 2.091.1 but I'm not sure what 
has changed since then that might cause this problem. I am 
working on creating a reduced test case using Dustmite but 
haven't been successful yet as it keeps reducing to an empty set.

Any tips on what to do/check?

Thanks!


More information about the Digitalmars-d-learn mailing list