mfc >> Undefined derived class

by TmVpbCBC » Sat, 22 Jan 2005 22:41:03 GMT

I'm developing an app in C++ using VS.net. I derived a class "CDate" from
COleDateTime using the class wizard (Generic class). This produced a .cpp and
.h file which I've included like all other classes.

When I defined objects of the class "CDate" in a .cpp file it worked fine.
When I tried to define an object in a .h file I got the compiler message
below:

c:\ActBooks\ReporterView.h(148): error C2079: 'CReporterView::m_lockDate'
uses undefined class 'CDate'

I've tried everything I can think of to identify the class to the .h file
but nothing works.

Any ideas why the compiler can't see CDate class when compiling the .h files?

Thanks for any ideas,
Neil



mfc >> Undefined derived class

by David Lowndes » Sun, 23 Jan 2005 00:59:45 GMT


>I'm developing an app in C++ using VS.net. I derived a class "CDate" from

Neil,

The only logical reason is that you've not included the header file
for your derived class in the header file that you're trying to make
use of it.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



mfc >> Undefined derived class

by TmVpbCBC » Mon, 24 Jan 2005 22:31:07 GMT

David,

Thanks for answering my question.
Although I've tried what you suggested, having someone else confirm my
conclusions is helpful.

FYI, I continued to poke at the problem and finally discovered that the
problem has something to do with the way "pragma once" works. I commented it
out of the CDate.h file and replaced it with the older technique of:


#ifndef CDATE_H
#define CDATE_H
.........
.........
#endif

when I did this the compiler could see the CDate class when processing .h
files.

Thanks for your help
Neil