Template error on compiling ...

Robin robbepop at web.de
Fri Feb 28 12:54:40 PST 2014


Hiho,

with

import neoLab.core.Matrix;

abstract class ElementalOperation(T = double) {
     abstract void opCall(ref Matrix!T m);
     abstract override string toString();
}

where I have made the abstract class templated "(T = double)" and 
where I have added a "!T" after "Matrix" in the opCall parameter 
list I get the following error:

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: 
In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
--- errorlevel 1

When I leave the (T = double) template assignment out I get 
another error:

neoLab/core/ElementalOperation.d(6): Error: undefined identifier T

With Tobias Pankrath's Matrix!() I get the following linker error:

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: 
In function `_start':
(.text+0x20): undefined reference to `main'
ScaleRowOperation.o: In function

.... many many many lines of unuseful error messages ...

(.text._D6neoLab4core6Matrix11__T6MatrixZ6Matrix6randomFxmxmdddZS6neoLab4core6Matrix11__T6MatrixZ6Matrix+0x145): 
undefined reference to 
`_D6neoLab4core9Dimension9Dimension4sizeMxFNaNbNdZm'
collect2: error: ld returned 1 exit status
--- errorlevel 1

So, in conclusion. I still have no clue why this more or less 
simple construct does not work but gives me errors on compiling.

Robin


More information about the Digitalmars-d-learn mailing list