Recommended Posts

I have written a class named CMessage in order to hold text messages (titles & bodies). When I link this class to the main source code, but not define an object with it, I don't get any warning or error message. But when a define an object
CMessage message;
I get an error like this :

Share this post

Link to post

Share on other sites

Looks to me like wndNewMessage.h doesn't #include the header that CMessage is defined in, or if it does, you have a circular dependancy. That error looks like you've just declared CMessage as:class CMessage;in wndNewMessage.h, and to derive a class you require the full declaration of the class to be visible.

0

Share this post

Link to post

Share on other sites

Original post by Evil SteveLooks to me like wndNewMessage.h doesn't #include the header that CMessage is defined in, or if it does, you have a circular dependancy. That error looks like you've just declared CMessage as:class CMessage;in wndNewMessage.h, and to derive a class you require the full declaration of the class to be visible.

Thank you Steve. The problem was just like you said. I had made the symbolic declaration of CMessage in a different file but didn't include its code to the project.