[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
How to link templates?
Hi all
I have a template class in C++, which is split in .h/.cpp format. Now I want to create a shared library for it. So that
'#include " .h" ' should suffice.
However, when I create a shared library with normal procedure of creating shared library, linking of programs fails
saying 'unresolved symbol myobject<int>::method() not found.'
What's the difference in linking normal code and template code? I mean how can I tell linker that this is a template
code?
My steps are
$ g++ -c myobject.cpp; ld -shared -soname Libname myobject.o
$ g++ -o myprog -L. -lLibname myprog.cpp.
TIA...
Bye
Shridhar