Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Link with a template class from a share object (c++)

Reply
Thread Tools

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

 
 
nivas
Guest
Posts: n/a
 
      11-21-2006
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

 
Reply With Quote
 
 
 
 
ondra.holub
Guest
Posts: n/a
 
      11-21-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
Declaring a template class with two template params a friend in anon-template class A L C++ 1 08-25-2010 07:25 AM
using std::map in a template class, getting LNK2019 link error when creating an object from this template class girays C++ 1 01-20-2007 09:47 PM
problem calling method from parent of an object if object relayson template arguments of current template class? =?UTF-8?B?UmFmYcWCIE1haiBSYWYyNTY=?= C++ 2 03-02-2006 05:45 AM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM



Advertisments