From: "K.A.R.L." Newsgroups: comp.os.msdos.djgpp Subject: Re: Linking Multi-File Project w/Templates Date: Fri, 31 Jan 1997 15:43:01 +0100 Organization: Universidade de Santiago Lines: 41 Message-ID: <32F204F5.4A21@usc.es> References: <32EFCB46 DOT 11FC AT ELECOM2 DOT Watstar DOT UWaterloo DOT CA> Reply-To: farega AT usc DOT es NNTP-Posting-Host: mclacopo.usc.es Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Mike Habicher wrote: > > I still can't get ld to link my multi-file > project. The project involves a class that > has its declarations stored in a .h file, > which is included in two C++ files: the first > one containing the actual code of the class' > member functions, and the second one which is > supposed to exercise the class to locate any > possible coding errors. > > The class uses templates, and while the source > files compile without errors, I get a whole > bunch of "unresolved" errors when I try to link > them together. > > Is there some sort of parameter I need to > specify during the compile to get templates > to compile properly? Or some modification I > need to make to source files? When I started working with DJGPP I had a similar problem with templates, and found the solution on the gcc info file, in the section devoted to C++ extentions. The idea is to compile the modules with the -fno-implicit-templates switch, and add in the file where you define the classes an explicit declaration of the concrete instances you need. For example, you have the template class foo: template foo { // all the stuff } // explicit instantiations for each type you need template class foo template class foo This way it worked for me. Hope this helps!