 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
nivas Guest
|
Posted: Tue Nov 21, 2006 10:10 am Post subject: Link with a template class from a share object (c++) |
|
|
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
|
Posted: Tue Nov 21, 2006 10:11 am Post subject: Re: Link with a template class from a share object (c++) |
|
|
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 |
|
 |
|
|
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
|
|