From owner-help-octave at bevo dot che dot wisc dot edu Thu Jan 18 14:20:01 1996 Subject: liboctave questions From: "John W. Eaton" To: Andrew Smallbone Cc: help-octave at che dot utexas dot edu Date: Thu, 18 Jan 1996 14:19:32 -0600 Andrew Smallbone wrote: : >>>>> "jwe" == "John W Eaton" writes: : : jwe> : 1. Although the Array is a templated class arrays of floats don't : jwe> : seem to work (the resize() method doesn't exist). Should Arrays be : jwe> : able to work with other types? : jwe> Yes. : : The following program: : ------- : #include "Array.h" : main(int argc, char *argv[]) : { : Array a(10); : } : ------- : compiled with ``gcc -o test test.cc -loctave -lcruft -lf2c -lg++ -lm'' : produces: : Undefined first referenced : symbol in file : _._t5Array1Zf stats.o : __t5Array1ZfiRCf stats.o You need to tell the compiler to create an instance of the Array type. Try adding template class ArrayRep; template class Array; to your file. With future versions of Octave, you will only need to instantiate Array, and maybe someday, g++ will do this automatically. If you use Array in more than one file, you can put the instantiation in a separate file. : The above works fine with ``Array'' but fails for every other : type. It works for Array because that instance of the Array class is already in the library. Octave doesn't need Array, so it's not in there. jwe