[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
John W. Eaton
Thu, 18 Jan 1996 14:19:32 -0600
Andrew Smallbone <address@hidden> wrote:
: >>>>> "jwe" == "John W Eaton" <address@hidden> 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<float> a(10);
: compiled with ``gcc -o test test.cc -loctave -lcruft -lf2c -lg++ -lm''
: 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<float> type. Try adding
template class ArrayRep<float>;
template class Array<float>;
to your file. With future versions of Octave, you will only need to
instantiate Array<TYPE>, and maybe someday, g++ will do this
If you use Array<float> in more than one file, you can put the
instantiation in a separate file.
: The above works fine with ``Array<double>'' but fails for every other
It works for Array<double> because that instance of the Array class is
already in the library. Octave doesn't need Array<float>, so it's not