Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Template inheritance and linker error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="little.freaky, post: 2587078"] Hello group, I have a problem with template classes and inheritance. I've searched on the internet to find a solution but all the examples look the same as my code (as far as I can tell) and I can't find my mistake (maybe there's something wrong with my eyes). I've two classes: template< class T > class ITestTemplateA { public: ITestTemplateA() { }; virtual ~ITestTemplateA() { }; }; template< class T > class TestTemplateB : public ITestTemplateA< T > { public: TestTemplateB(); virtual ~TestTemplateB(); }; and the implementation of TestTemplateB: template < class T> TestTemplateB<T>::TestTemplateB() { } template< class T > TestTemplateB<T>::~TestTemplateB() { } Now I want to instantiate an object of type TestTemplateB: TestTemplateB<ITrack>* track = new TestTemplateB<ITrack>(); Where ITrack is another class, but I think that the source-code to that class isn't important (?). This compiles but the linker shows an error: error LNK2001: unresolved external symbol "public: __thiscall TestTemplateB<class ITrack>::TestTemplateB<class ITrack>(void)" (??0?$TestTemplateB@VITrack@@@@QAE@XZ) Can somebody tell my what I'm doing wrong? thanks in advance Michael Doswald [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Template inheritance and linker error
Top