Link error with template struct on 2.042
Frank Fischer
frank-fischer at shadow-soft.de
Wed Mar 31 00:26:24 PDT 2010
Hi,
after some time I started again playing with D. The following example
gives an error I don't understand (I'm trying dmd 2.042):
==== main.d ====
import MyMod;
void main()
{
MyStruct!(int) s;
}
==== MyMod.d ===
module MyMod;
struct MyStruct(T) {
this(this) {}
}
================
If I compile the above example with
dmd main.d
I get the following error:
main.o: In function
`_D5MyMod15__T8MyStructTiZ8MyStruct10__postblitMFZv':
main.d:(.text._D5MyMod15__T8MyStructTiZ8MyStruct10__postblitMFZv+0x12):
undefined reference to `_D5MyMod8__assertFiZv'
main.o: In function
`_D5MyMod15__T8MyStructTiZ8MyStruct8opAssignMFNcS5MyMod15__T8MyStructTiZ8MyStructZS5MyMod15__T8MyStructTiZ8MyStruct':
main.d:(.text._D5MyMod15__T8MyStructTiZ8MyStruct8opAssignMFNcS5MyMod15__T8MyStructTiZ8MyStructZS5MyMod15__T8MyStructTiZ8MyStruct+0x12):
undefined reference to `_D5MyMod8__assertFiZv'
collect2: ld returned 1 exit status
--- errorlevel 1
What does this mean? Note that everything works fine if MyStruct is
not a template, if there's no function this(this) or if I compile the
example with assertions disabled like this:
dmd -release main.d
It seems as I'm missing to implement some function, but I don't know
which.
Thanks in advance
Frank
More information about the Digitalmars-d-learn
mailing list