Re: undefined reference to class template

2014-12-05 Thread Satoshi via Digitalmars-d-learn
I have defined LinkedList as di file, Im not compiling it. Im 
compiling every .d file separately, eg. main.d - main.d.o 
without including anything else.


I tried to use -femit-templates but nothing happnes.

I dont have object file of LinkedList.di, Im only importing it in 
source file and with -I


Re: undefined reference to class template

2014-11-23 Thread Kapps via Digitalmars-d-learn

On Friday, 14 November 2014 at 23:29:34 UTC, 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)


Sounds like you're not passing in LinkedList.d while compiling a 
file that uses it. You need to include all used files, including 
imports, on the command line when compiling. The undefined 
reference indicates it can't find the source code or di file 
containing LinkedList. Tools like rdmd do this for you by looking 
at the imports used automatically.


If not that, I'm not sure if this will help, but try using 
-femit-templates (similar to -allinst in DMD I believe?).


Besides that, all I can really suggest is double checking that 
you're actually including the object file containing LinkedList 
when you're linking and the source file when compiling.


Re: undefined reference to class template

2014-11-22 Thread Satoshi via Digitalmars-d-learn
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.


Re: undefined reference to class template

2014-11-17 Thread Satoshi via Digitalmars-d-learn

Could anyone help me please?


Re: undefined reference to class template

2014-11-17 Thread Steven Schveighoffer via Digitalmars-d-learn

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


undefined reference to class template

2014-11-14 Thread Satoshi via Digitalmars-d-learn
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)