[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
How to link templates?
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
My steps are
$ g++ -c myobject.cpp; ld -shared -soname Libname myobject.o
$ g++ -o myprog -L. -lLibname myprog.cpp.