undefined reference to `_D15TypeInfo_Struct6__vtblZ'

Mike none at none.com
Mon Dec 23 05:34:30 PST 2013


On Monday, 23 December 2013 at 13:19:21 UTC, Mike wrote:
> On Monday, 23 December 2013 at 12:57:33 UTC, Johannes Pfau 
> wrote:
>> Am Mon, 23 Dec 2013 12:03:09 +0000
>> schrieb "Mike" <none at none.com>:
>>
>>> Thanks for all the help lately.  I'm sorry to be flooding 
>>> this list with so many questions, but I'm making good 
>>> progress, and still running into some things I don't quite 
>>> understand.
>>> 
>>> I'm getting the following linker error as soon as I add a 
>>> struct to my code.
>>> 
>>> undefined reference to `_D15TypeInfo_Struct6__vtblZ'
>>> 
>>
>> It looks like you didn't compile object.d? The vtblZ symbols 
>> are only
>> generated when you compile a .d file and then you have to link 
>> in the
>> resulting object file, importing alone is not enough.
>>
>> So something like
>> arm-eabi-gdc object.d -o object.o
>> link object.o start.o -o start
>
> Thanks johannes.  I already tried just as you suggested, but 
> when I tried it, I ended up with multiple definitions as shown 
> below.  This is why I assumed it was compiled automatically
>
> start.o:(.rodata._D6Object6__initZ+0x0): multiple definition of 
> `_D6Object6__initZ'
> object.o:(.rodata._D6Object6__initZ+0x0): first defined here
> start.o:(.rodata._D6Object6__vtblZ+0x0): multiple definition of 
> `_D6Object6__vtblZ'
> object.o:(.rodata._D6Object6__vtblZ+0x0): first defined here
> start.o:(.data._D6Object7__ClassZ+0x0): multiple definition of 
> `_D6Object7__ClassZ'
> object.o:(.data._D6Object7__ClassZ+0x0): first defined here
> start.o:(.rodata._D14TypeInfo_Class6__vtblZ+0x0): multiple 
> definition of `_D14TypeInfo_Class6__vtblZ'
> object.o:(.rodata._D14TypeInfo_Class6__vtblZ+0x0): first 
> defined here
>
>
> So I'm quite confused.  Do I need and object.di file instead? 
> Is there something to naming "object_.d" (trailing underscore) 
> instead of "object.d"?

Cancel that.  I had a makefile typo.  My mistake.  You are 
correct.


More information about the D.gnu mailing list