CMonthCalCtrl in VS2005

While trying to convert an eVC++ project to VS2005, when I do a build I get the following error:

error C2146: syntax error : missing ';' before identifier 'm_dateMatch'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int      

The line of code is:
CMonthCalCtrl      m_dateMatch;
Who is Participating?
mrjoltcolaConnect With a Mentor Commented:
Check to see if afxdtctl.h is in your stdafx.h
#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls

Open in new window

Wanting2LearnManAuthor Commented:
It is in as follows:

#if defined(_AFXDLL)
#include <afxdtctl.h>            // MFC support for Internet Explorer 4 Common Controls

itsmeandnobodyelseConnect With a Mentor Commented:
>>>> CMonthCalCtrl      m_dateMatch;

There are two common reasons for that error:

1. The issue is not in that line but in the line before where for example you forgot the semicolon ; or have a colon : instead.

2. You forgot to include the header for the CMonthCalCtrl

The second is that mrjoltcola assumed.

If you include a new headerfile in one of your headers you might need to make a 'Rebuild all' after in case your project uses 'Precompiled Headers' (PCH).  AFAIK all VC versions have problems to regocnize reliably changes where a new PCH was needed to be built.
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

itsmeandnobodyelseConnect With a Mentor Commented:
>>>> #if defined(_AFXDLL)
That is only set in a dll project using MFC
mrjoltcolaConnect With a Mentor Commented:
Check that _AFXDLL is defined, or change to use the #ifdef I provided, it is possible the #if defined(_AFXDLL) is from older projects. I don't have any evc4 projects to refer to anymore so I cannot confirm.

Did you create a new project from scratch or convert the old one?
Wanting2LearnManAuthor Commented:
I converted from an old project.

I could not find _AFXDLL  defined anywhere.  I used the code you provided and it has now got past this error.

Thanks all
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.