On 7/17/2012 11:08 AM, Victor Bazarov wrote:
On 7/17/2012 10:33 AM, Peter Davis wrote:
I'm trying to define a template class ...
...
This follows, as I understand it, the 'curiously recurring template'
pattern. However, when I try to compile (Visual Studio 2008), I get the
error:
C2504: 'CloneableImpl' : base class undefined.
on the line defining class Node. I don't understand why, since the cpp
file includes the header file in which the template Cloneable is
defined, and they're in the same namespace.
Any insights?
Not with your incomplete code. See FAQ 5.8.
This code:
--------------------------------------------------
--------------------------------------------------
compiles fine with VC++ 2010. I don't have 2008 to test.
Thank you. I'm still not sure what was going on, but I found that
forward declaring the cloneable class seems to work in VS2008:
class Node;
class Node : public BaseObject, Cloneable<Node>
...
I have about 30 classes, 2nd- and 3rd-derivatives of BaseObject, and
most built just fine without the forward declaration. When time permits,
I'll do some more investigating and post any findings here.
switching to 2010 or even to 2012 (which is in RC stage now).