undefined reference to class template

Satoshi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 14 15:29:33 PST 2014


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)


More information about the Digitalmars-d-learn mailing list