Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

templates

Status
Not open for further replies.

pauloco

Programmer
Jun 19, 2003
3
CL
Hi

I am using a library that define templates, the templates are
explicitly instatiated in separate file i.e.

Array_1000.cc
#include <aips/Arrays/Array.cc>
template class Array<float>;

the problem is when I link to the library I get
unresolved externals on all the templates. I am using the
-fno-implicit-templates compiler flag.

anyone know how to solve this?

Thanks!!
 
Not sure which flavour of unix you're using. On Solaris, there is a -ptr or similar parameter. It changes depending on version. You have to include this in the command line and link using CC: not ld.
 
You were right I forgot :)

I am using g++ 2.95 on a linux system
 
I guess that when you use a template, you generally define the methods in that header file itself. This is because the template instantiation will need the class declaration and definition. So it's better to put the template related things inside a single file and use that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top