Link to home
Start Free TrialLog in
Avatar of gkatz
gkatz

asked on

compiling templates with xlC

Hi everyone,
    Recently I wrote a piece of software that was compiled with the sun CC compiler.  I now need to recompile the software for another system that uses the xlC compiler.  The software seems to compile correctly with xlC but then when it tries to link together the different files I am getting an error.  I did not get any errors when compiling on the Sun.  The error I am getting is:
Undefined Symbol .foo<double>::~foo()

where foo would be the name of a template class that I had created and double would be the type that it is trying to be set to be used as.  
I am getting one Undefined Symbol error for each function in the template and for each type it is being used as.

I am wondering if anyone else has had any trouble linking templates with xlC and if there are any parameters that need to be set in the compiler to get it to work.  

Thanks in advance.
Avatar of Mafalda
Mafalda

You need to instantiate the templates used ...
On the sun there is a directory where all the templates instantiations go ... you need to clean it up (usually manually or using the MAKEFILE) and then rebuild.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gkatz

ASKER

Thank you both for your suggestions.  
Mafalda could you please go into a little bit more explanation.  I'm not sure exactly how to instantiate a template.  When compiling on the solaris 9 or on a windows box I always just wrote templates without having to do anything special.  
Avatar of gkatz

ASKER

jkr your suggestion worked.  I moved the c++ source into the header file and it compiled fine.  

Thanks again for both of your help.


gkatz