Hello. I am using root version 3.05/05 on linux (RedHat 9, i386), with gcc
version 3.2.2. Here is a simple example:
//-----------------------test.h
#include <Rtypes.h>
template<class T>
class temp {
T a;
public:
test() {};
T Get();
void Set(T new_a);
ClassDef(test<T>,1)
};
//-----------------------test.C
#include "test.h"
template<class T>
ClassImp(test<T>)
template<class T>
T test<T>::Get() {
return a;
}
template<class T>
void test<T>::Set(T new_a) {
a=new_a;
}
When I try to compile this I get the following error:
[mdn@hermit root_template_test_class]$ make
g++ -O -Wall -fPIC -D_REENTRANT -I/home/mdn/root/include -c -o test.o test.C
test.C:4: parse error before `namespace'
test.C:4: `T' was not declared in this scope
test.C:4: template argument 1 is invalid
test.C:4: ISO C++ forbids declaration of `parameter' with no type
test.C:4: `T' was not declared in this scope
test.C:4: template argument 1 is invalid
test.C:4: ISO C++ forbids declaration of `type name' with no type
make: *** [test.o] Error 1
I have attached the Makefile and sources. I would appreciate any help at all
in figuring this out. I am a bit confused by the macros root and cint use
here. A pointer to the relevant documentation would be very helpful. Thanks
in advance!
--
Regards,
Micha D. Niskin <mniskin@yahoo.com>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET