Our application makes use of C++ templates in a number of places. I am currently attempting to port from gcc 3.3.3 to 4.1.0 and am encountering issues. I have recreated the problem in a small shared library and executable. I am building the share library Ok, but the executable fails to link with the following:
undefined reference to `MyNumber<int>::~MyNumber()'
undefined reference to `MyNumber<int>::MyNumber(int)'
undefined reference to `MyNumber<int>::number()'
I am not using the template classes directly within the executable and would have expected this all to be encapsulated within the implementation within the shared library (probably naively so).
The problem only appears to show when working with a shared library. When I build our application on SLES 11 (gcc 4.3.2) most of my issues appear to be resolved but I still receive a number of the following:
undefined reference to `vtable for MYCLASS<T1, T2>'
This all when linking the executable to the shared libs.