C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Link with a template class from a share object (c++)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
nivas
Guest





PostPosted: Tue Nov 21, 2006 10:10 am    Post subject: Link with a template class from a share object (c++) Reply with quote



Hi.

I want to build a program which dynamically loads from a shared object
a template class.
Thus:
1. I am creating the shared_object.cpp, shared_object.h which defines
the <template> class 2. Build with g++ -shared -fPIC shared_object.cpp
-o libshared_object.so 3. Inlcude the shared_object.h in the sources of
the program 4. build the program with -lshared_object

Unfortunately it complains about undefined reference to the class.
Any help

Thanks
Nik
Back to top
ondra.holub
Guest





PostPosted: Tue Nov 21, 2006 10:11 am    Post subject: Re: Link with a template class from a share object (c++) Reply with quote



I think you have definition of template methods in .cc (.cpp) file, not
in header. When you want to use templates, you have to write
definitions of template methods (functions) into header.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.