undefined reference to class template

Satoshi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 22 03:54:01 PST 2014


On Monday, 17 November 2014 at 21:12:54 UTC, Steven Schveighoffer 
wrote:
> On 11/14/14 6:29 PM, Satoshi wrote:
>> Hi, Im using GDC 4.9.0 compiler. I have template classes like 
>> "public
>> class LinkedList(T) {...}" and when I try compile it together,
>> everything works fine. But when I compile every source file to 
>> separate
>> object file and link it together with ld Ill get errors like:
>>
>> "/os/KernelLand/Kernel/TaskManager/Thread.d:99: undefined 
>> reference to
>> `_D7Library10LinkedList45__T10LinkedListTC11TaskManager6Thread6ThreadZ10LinkedList6__ctorMFNaNbNfZC7Library10LinkedList45__T10LinkedListTC11TaskManager6Thread6ThreadZ10LinkedList'"
>>
>>
>> Im compiling it with command like:
>> gdc -mcmodel=kernel -nostdlib -mno-red-zone -Wall -masm=intel 
>> -frelease
>> -finline-functions -O3 -o obj-x86_64/abc.d.o -c abc.d
>>
>> Here is
>> full error log http://pastebin.com/SjnYjqKh
>>
>> makefile
>> https://github.com/Bloodmanovski/Trinix/blob/dc80f3197f59fe96e9f4e29cea670ff2c7eaa342/KernelLand/Kernel/Makefile#L104
>>
>>
>> LinkedList class
>> https://github.com/Bloodmanovski/Trinix/blob/dc80f3197f59fe96e9f4e29cea670ff2c7eaa342/KernelLand/Kernel/Library/LinkedList.d
>>
>>
>>
>> Can anyone help me how to solve this problem? Thanks
>> (Sorry for bad english)
>
> Try linking with gdc instead of ld.
>
> -Steve

I tried it but it still dont works.


More information about the Digitalmars-d-learn mailing list