CDialogEx undefined class

I  am  creating MDI project with CFormView.
On Views Form dialog I  placed a  button.
And  inserted one more dialog  in project  (IDD_DIALOG1)
Created One class(CDia) derived from CDialogEx which is using (IDD_DIALOG1) using "AddClass"
On Button click  I  written  following code
CDia  dia;
dia.DoModal();

And added appropriate header file "Dia.h"
On compiling  it gives error CDialogEx  undefined.
I  am using Visual Studio 2010 Professional
Please help me to solve thia issue
ADITYA RAOSoftware DeveloperAsked:
Who is Participating?
 
sarabandeConnect With a Mentor Commented:
CDialogEx is defined in afxdialogex.h. if you create a new mfc application project the afxdialogex.h was available, probably via afxcontrolbars.h.

i suppose your project was created in a previous version of visual studio.

if you want to use the newest features of vs2010 you could try to include that header manually in the stdafx.h. if that doesn't work (or needs more includes), i would recommend you create a new vs2010 project by wizard, delete all newly generated source files beside of stdafx.h from solution tree (project tree), copy all source files other than stdafx.h from old project, add those files to project tree again and rebuild.

Sara
0
 
jkrCommented:
Can you post the relevant code?
0
 
ADITYA RAOSoftware DeveloperAuthor Commented:
class CDia : public CDialogEx
{
	DECLARE_DYNAMIC(CDia)

public:
	CDia(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDia();

// Dialog Data
	enum { IDD = IDD_DIALOG1 };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
};

void CMerilisaRView::OnBnClickedButton1()
{
	CDia cd;
	cd.DoModal();
	
} 

Open in new window


Error    1    error C2504: 'CDialogEx' : base class undefined  e:\aditya
practice\merilisar\merilisar\dia.h    7    1  MerilisaRHandlers
Error    2    error C2039: 'DoModal' : is not a member of 'CDia'
 e:\aditya practice\merilisar\merilisar\merilisarview.cpp    118  1  
 MerilisaRHandlers
0
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.