Date: Thu, 8 May 1997 23:13:03 +0200 (CEST) From: matra To: djgpp AT delorie DOT com Subject: djgpp & templates Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Hi! Im a C user of Djgpp that has to switch to C++ for some projects . Can any1 help me using templates with djgpp 2.7.2 og g++ 2.7.2.1 under FreeBSD ? This is my problem : this simple class doesn't compile ! WHY!??? ... :-<<<< (file "myclass.cc") #include "myclass.h" template myclass::myclass(T tinf) { cout << "Hello World!" << endl; inf = tinf; } (file "mytest.cc") #include "myclass.h" int main(void) { myclass myc(3); return 0; } (file "myclass.h"); #include template class myclass { public: myclass(T); private: T inf; }; class myclass; // without this the linker says "undefined reference"!!! ...and this is the compile result (same under djgpp/g++): [matra] $ g++ myclass.cc mytest.cc -o mytest mytest.cc: In function `int main()': mytest.cc:5: variable `class myclass myc' has initializer but incomplete type mytest.cc:5: aggregate `class myclass myc' has incomplete type and cannot be initialized Can any1 help me posting a WORKING example of templates under djgpp? hoping for help... cul8r