MLUG: [UUG/MLUG] egcs template compiler problem
[UUG/MLUG] egcs template compiler problem
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hey all,

I've implemented a basice Queue class in C++ using templates.  As is
normal I have a Queue.H and a Queue.C file.  To test it out I have a
testQ.C file which includes iostream.h and the Queue.H file. 

I compile on the SGI's (CC Queue.C testQ.C -o testQ) and it works
perfectly.

I compile on my Linux machine at home using g++ (gcc version
egcs-2.91.60, egcs-1.1.1) using the command: g++ Queue.C testQ.C -o testQ
(g++ Queue.C testQ.C -o testQ) and I get compiler errors.  The errors
state:

In function 'main' :
	: undefined referecne to 'Queue<int>::push(int)'
	: undefined reference to 'Queue<int>::pop(void)'
	: undefined reference to 'Queue<int>::~Queue(void)'
	: undefined reference to 'Queue<int>::~Queue(void)'

I tried the same code and compilation on mlug.missouri.edu and used g++ on
my SGI  and received basically the same errors. Mlug's version of g++ is
egcs-1.0.3 release.

I was knocking my head against the wall so I tried just moving the Queue.C
code to the Queue.H file.  TADA -- works like a charm.
(g++ testQ.C -o testQ)

So the big question is are templates on egcs compilers broken??  Is a fix
in the works??

-jeremy

------
 Jeremy Hinegardner             EMAIL:PROTECTED
 Research Assistant             http://meru.cecs.missouri.edu

 University of Missouri - Columbia
 Multimedia Communications and Visualization Laboratory
------