Linking Errors

Fawzi Mohamed fmohamed at mac.com
Wed Jun 18 08:20:50 PDT 2008


On 2008-06-18 14:59:59 +0200, Phr00t <phr00t at gmail.com> said:

> Denis Golovan Wrote:
> 
>> Phr00t Wrote:
>> 
>>> Hey all,
>>> 
>>> I posted this problem to dsource.org, but I'm not sure how many faces see that
>>> forum...
>>> 
>>> This problem is driving me nuts.. does anyone have any suggestions?
>>> 
>>> I get no code warnings / errors in the following code during compilation. I
>>> can have FU_ITEM and FU_SHIP objects, and I can have dlinkedlists of FU_SHIPs,
>>> but not of FU_ITEMs as they create linking errors.
>>> 
>>> Take the following test code:
>>> 
>>> ---------------------------- test.d -----------------
>>> module test;
>>> 
>>> private import arc.templates.dlinkedlist;
>>> 
>>> private import classes.item;
>>> private import classes.ship;
>>> 
>>> void main() {
>>> 
>>> FU_ITEM OKItem = new FU_ITEM();
>>> FU_SHIP OKShip = new FU_SHIP();
>>> 
>>> dlinkedlist!(FU_ITEM) failItemList = new dlinkedlist!(FU_ITEM);
>>> dlinkedlist!(FU_SHIP) OKShipList = new dlinkedlist!(FU_SHIP);
>>> 
>>> }
>>> ------------------------------------------------------------
>>> 
>>> It gives these errors on linking:
>>> 
>>> ./_test.o: In function `_Dmain':
>>> test.d:(.text._Dmain+0x25): undefined reference to
>>> `_D3arc9templates11dlinkedlist40__
>>> T11dlinkedlistTC7classes4item7FU_ITEMZ11dlinkedlist7__ClassZ'
>>> test.d:(.text._Dmain+0x30): undefined reference to
>>> `_D3arc9templates11dlinkedlist40__
>>> T11dlinkedlistTC7classes4item7FU_ITEMZ11dlinkedlist5_ctorMFZC3arc9templates11dlinkedlist40__T11dlinkedlistTC7classes4item7FU_ITEMZ11dlinkedlist'

I 
>>> 
>>> am using:
>>> * Ubuntu 8.04
>>> * dmd v1.0.30
>>> * GNU ld (GNU Binutils for Ubuntu) 2.18.0.20080103
>>> * ArcLib's template linked list
>>> 
>>> Any ideas? I'd like to continue work on FreeUniverse.. but this has been a
>>> show-stopper. :(
>> 
>> Well, AFAIU linker cannot find compiled template linked list.
>> So, maybe command line (makefile) for compilation does not include 
>> template linked list compiled object file?
>> 
>> Best regards, Denis
> 
> Thank you for your reply.
> 
> If it did not include the linked list object file, then wouldn't it 
> also complain about this line?
> 
> dlinkedlist!(FU_SHIP) OKShipList = new dlinkedlist!(FU_SHIP);
> 
> Because it only complains about FU_ITEM's dlinkedlist :-(
> 
> - Phr00t


- there might be a library or .o file conncted to arc that you have to link

In general (not directly connected with your problem)
- use dsss to build you stuff (normally it figures out the dependencies)
- be careful to to mix phobos/tango librares unless you use 
tango+tangobos (and even then be careful)

Fawzi



More information about the Digitalmars-d-learn mailing list