Xref: news-dnh.mv.net comp.os.msdos.djgpp:2546 Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!academ!bcm.tmc.edu!news.msfc.nasa.gov!newsfeed.internetmci.com!howland.reston.ans.net!Germany.EU.net!wizard.pn.com!satisfied.apocalypse.org!news2.near.net!ctp.com!news From: pdrap AT ctp DOT com (Patrick Draper) Newsgroups: comp.os.msdos.djgpp Subject: Re: More info with the template problem Date: Tue, 10 Oct 1995 14:42:06 GMT Organization: Cambridge Technology Partners Lines: 126 References: <45de6r$mv2 AT concorde DOT ctp DOT com> Reply-To: pdrap AT ctp DOT com Nntp-Posting-Host: vuitpc08.nl.ctp.com To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Here's YET ANOTHER followup to the other two pleas for help that I posted, in order to provide you with more information. I just downloaded the version 2.0 beta version of DJGPP and I have the same problem compiling the code. I expected to have the problem because it's still gcc version 2.6.3. By the way, the new beta version seems to be really damn fast! Very nice work. pdrap AT ctp DOT com (Patrick Draper) wrote: >I'm including more information with the template problem that I'm having. >In my research of how gcc handles templates, I ran across the web page that >explains how to make templates work with gcc, but I can't figure out >exactly how to get it to compile. >I've included a very tiny example, and the compiler output to show my >problem. The compiler that I'm using is DJGPP 1.12 maint 3, and the gcc >version is 2.6.3. >------------------------------------------------------------------------------------------------------------ >File: templates.h >------------------------------------------------------------------------------------------------------------ >template >class A { > public: > void f (); > T t; >}; > >template void g (T a); >------------------------------------------------------------------------------------------------------------ >File: templates.cc >------------------------------------------------------------------------------------------------------------ >#include "templates.h" > >template >void A::f () { } > >template >void g (T a) { } >// explicit template instantiation These lines are here because >// the FAQ said that they had to be there to work with gcc. >template class A >template void g (A); >------------------------------------------------------------------------------------------------------------ >File: main.cc >------------------------------------------------------------------------------------------------------------ >#include "templates.h" > >main () >{ > A a; > a.f (); > g (a); >} >------------------------------------------------------------------------------------------------------------ >File: makefile >------------------------------------------------------------------------------------------------------------ >CC=gcc >CFLAGS=-Wall >LIBS=-lm -lgpp >.cc.o: > $(CC) -c $(CFLAGS) -o $*.o $< >LIBOBJS=main.o templates.o >main: $(LIBOBJS) > gcc $(CFLAGS) -o main $(LIBOBJS) $(LIBS) >main.o: main.cc templates.h >templates.o: templates.cc templates.h >------------------------------------------------------------------------------------------------------------ >Compiler output >------------------------------------------------------------------------------------------------------------ >c:> make >gcc -c -Wall -o main.o main.cc >gcc -c -Wall -o templates.o templates.cc >templates.h:11: parse error at null character >make.exe: *** [templates.o] Error 1 >As you can see, the advice in the FAQ doesn't help! What am I missing here? >Thanks,