Solved

compiling templates with xlC

Posted on 2004-04-13
4
297 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:gkatz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Mafalda
ID: 10816114
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.
0
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 10816185
Do you have the template code split into header and implementation files? Most compilers do not support that.
0
 
LVL 3

Author Comment

by:gkatz
ID: 10822233
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.  
0
 
LVL 3

Author Comment

by:gkatz
ID: 10822454
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question