class derived from template class

C

Corey Wirun

Hi All,

I've got a template class:

template < typename T >
class A: public B
{
public:
A();
virtual ~A();
virtual void PreSubclassWindow();
virtual void DefineColumns( int i ) = 0;
...
}

And I want to derive a class from 'A' called 'Derived':

class Derived: public A< DataClass >
{
Derived();
virtual ~Derived();
}

The problem is that when I link (VS.Net 2002, unmanaged), I get 'unsolved
symbols' for the constructor and all virtuals for the base class 'A', in the
derived class' object code.

e.g.
B.obj: unresolved external symbol "protected: virtual void __thiscall
A<class DataClass>::preSubclassWindow(void)"
(?PreSubclassWindow@?$A@VDataClass@@@@MAEXXZ)

Does anyone know why this occurs? Is there something extra I have to do
syntactically to get it to work?

Thanks all!
C.
 
D

David Hilsee

Corey Wirun said:
Hi All,

I've got a template class:

template < typename T >
class A: public B
{
public:
A();
virtual ~A();
virtual void PreSubclassWindow();
virtual void DefineColumns( int i ) = 0;
...
}

And I want to derive a class from 'A' called 'Derived':

class Derived: public A< DataClass >
{
Derived();
virtual ~Derived();
}

The problem is that when I link (VS.Net 2002, unmanaged), I get 'unsolved
symbols' for the constructor and all virtuals for the base class 'A', in the
derived class' object code.

e.g.
B.obj: unresolved external symbol "protected: virtual void __thiscall
A<class DataClass>::preSubclassWindow(void)"
(?PreSubclassWindow@?$A@VDataClass@@@@MAEXXZ)

Does anyone know why this occurs? Is there something extra I have to do
syntactically to get it to work?

Is all of the template code in the header? See the FAQ
(http://www.parashift.com/c++-faq-lite/) section 34 if you don't understand
why you have to do that.
 
A

Andre Kostur

Hi All,

I've got a template class:

template < typename T >
class A: public B
{
public:
A();
virtual ~A();
virtual void PreSubclassWindow();
virtual void DefineColumns( int i ) = 0;
...
}

And I want to derive a class from 'A' called 'Derived':

class Derived: public A< DataClass >
{
Derived();
virtual ~Derived();
}

The problem is that when I link (VS.Net 2002, unmanaged), I get
'unsolved symbols' for the constructor and all virtuals for the base
class 'A', in the derived class' object code.

e.g.
B.obj: unresolved external symbol "protected: virtual void __thiscall
A<class DataClass>::preSubclassWindow(void)"
(?PreSubclassWindow@?$A@VDataClass@@@@MAEXXZ)

Does anyone know why this occurs? Is there something extra I have to
do syntactically to get it to work?

Where's the body of PreSubclassWindow? It's a virtual, not a pure
virtual.... so it must have a body....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,479
Latest member
JaysonK723

Latest Threads

Top