qq_43548756
别弄里面啊笨蛋
2019-09-06 17:44

VC++6.0 MFC创建新的dialog报错

  • c++

在创建完成新的class(默认)后给主界面加入头文件后编译报错:
error C2143: syntax error : missing ';' before 'constant'
fatal error C1004: unexpected end of file found

部分具体代码:
主界面:
主界面头:
#include "stdafx.h"
#include "Happygame.h"
#include "HappygameDlg.h"
#include "DLG.h"
……按钮部分代码:
void CHappygameDlg::OnOK()
{
// TODO: Add extra validation here
DLG dlg;
dlg.DoModal();
CDialog::OnOK();
}
新dialog部分代码:
#if !defined(AFX_DLG_H__E092C23E_0190_4E76_B7EA_34E78B1110E0__INCLUDED_)
#define AFX_DLG_H__E092C23E_0190_4E76_B7EA_34E78B1110E0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DLG.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// DLG dialog

class DLG : public CDialog (此处是报错行!!!!!)
{
// Construction
public:
DLG(CWnd* pParent = NULL); // standard constructor

// Dialog Data
//{{AFX_DATA(DLG)
enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DLG)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:

// Generated message map functions
//{{AFX_MSG(DLG)
    // NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

};

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

#endif // !defined(AFX_DLG_H__E092C23E_0190_4E76_B7EA_34E78B1110E0__INCLUDED_)

其中新的dialog叫DLG
报错:error C2143: syntax error : missing ';' before 'constant'
fatal error C1004: unexpected end of file found

小白大二做MFC求解谢谢大佬

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐