[Last Call] Learn how to a build a cloud-first strategyRegister Now


CDialogEx undefined class

Posted on 2012-09-15
Medium Priority
Last Modified: 2012-09-20
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;

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
Question by:ADITYA RAO
LVL 86

Expert Comment

ID: 38401984
Can you post the relevant code?

Author Comment

ID: 38405131
class CDia : public CDialogEx

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

// Dialog Data
	enum { IDD = IDD_DIALOG1 };

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


void CMerilisaRView::OnBnClickedButton1()
	CDia cd;

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  
LVL 35

Accepted Solution

sarabande earned 1500 total points
ID: 38413685
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.


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question