Hello all, I'm working on a program using MFC and VS6, and when I split my program into files (aka: move certain portions to a new file for easier reading and such), I get this error:

error C2065: 'IDD_DIALOG' : undeclared identifier
error C2057: expected constant expression

Here's the portion of my dialog class that's causing the errors:

#if !defined(AFX_DLG_H__94E25BA3_F903_4611_BB23_D1C559C46EBC__INCLUDED_)
#define AFX_DLG_H__94E25BA3_F903_4611_BB23_D1C559C46EBC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CDlg dialog
class CDlg : public CDialog
{
// Construction
public:
	CDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CDlg)
	enum { IDD = IDD_DIALOG };
	//}}AFX_DATA
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLG_H__94E25BA3_F903_4611_BB23_D1C559C46EBC__INCLUDED_)

And the file which calls CDlg.h:

#if !defined(AFX_P_H_INCLUDED_)
#define AFX_P_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "StdAfx.h"
#include "Dlg.h"

class CP : public CDlg{
// various functions and such
};

#endif

Does anyone know how to fix this? (I've been trying for a while, but the error itself is confusing to me [as to why it's even occuring]).

Sorry for this post, but I couldn't figure out how to edit the post.

I fixed this error by adding:

#include "Resource.h"

at the top of the header that was causing the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.