"Bernd Strieder" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > michael wrote: > > > I have the following in a class: > > > > template<class T> > > bool Utility::getInput(T& i, T low, T up){ > > > } > > > > in another file and class I have : > > > > Utility utility; > > utility.getInput(sal, 0.0, 999999.99); > > utility.getInput(sid, 0, 999999); > > > > Now, if I put all this in one file it compiles no worries. But, if I > > compile it as is i get an error from the linker: > > Check the object files for the instances the compiler has created, and > you will see, that in the error case, the missing instance has not been > created anywhere. A template instance can only be created if the > template source code is included with the translation unit. >
probably a silly question, but how can I check what's in the object files? > There is a section on template instantiation in the gcc info pages, > which should answer your question and provide the possibilities to > resolve your problem. > > In the end you will probably have the template code included at the end > of the template header file, so the templates can be instantiated, > wherever they are used, and the linker can remove duplicates. > > > using gnu g++ v3.3.3 (same result on 3.4.2) > > Probably same result on every existing C++ compiler. > > Bernd Strieder > Thanks for your help _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus