VC错误 error C2143:

#if !defined(AFX_DDALINE_H__D2765BB7_6D0B_46C5_95FE_CC8CE0192EC9__INCLUDED_)
#define AFX_DDALINE_H__D2765BB7_6D0B_46C5_95FE_CC8CE0192EC9__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif

// _MSC_VER > 1000
// DDALine.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// DDALine dialog

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

// Dialog Data
//{{AFX_DATA(DDALine)
enum { IDD = IDD_DIALOG1 };
float m_stx;
float m_endx;
float m_sty;
float m_endy;
//}}AFX_DATA

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

// Implementation
protected:

// Generated message map functions
//{{AFX_MSG(DDALine)
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_DDALINE_H__D2765BB7_6D0B_46C5_95FE_CC8CE0192EC9__INCLUDED_)
显示错误如下:
DDALine.cpp
c:\program files\microsoft visual studio\myprojects\graph\ddaline.h(15) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft visual studio\myprojects\graph\ddaline.h(15) : fatal error C1004: unexpected end of file found
graphView.cpp
c:\program files\microsoft visual studio\myprojects\graph\ddaline.h(15) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft visual studio\myprojects\graph\ddaline.h(15) : fatal error C1004: unexpected end of file found
Generating Code...
执行 cl.exe 时出错.

graph.exe - 1 error(s), 0 warning(s)

第1个回答  推荐于2016-03-02
1>------ 已启动生成: 项目: TEMP, 配置: Debug Win32 ------
1>正在编译...
1>111.cpp
1>e:\c语言\第五章作业\temp\temp\111.cpp(16) : error C2504: “CDialog”: 未定义基类
1>e:\c语言\第五章作业\temp\temp\111.cpp(19) : error C2061: 语法错误 : 标识符“CWnd”
1>e:\c语言\第五章作业\temp\temp\111.cpp(23) : error C2065: “IDD_DIALOG1”: 未声明的标识符
1>e:\c语言\第五章作业\temp\temp\111.cpp(35) : error C2061: 语法错误 : 标识符“CDataExchange”
1>e:\c语言\第五章作业\temp\temp\111.cpp(47) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
1>e:\c语言\第五章作业\temp\temp\111.cpp(47) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\c语言\第五章作业\temp\temp\111.cpp(47) : warning C4183: “DECLARE_MESSAGE_MAP”: 缺少返回类型;假定为返回“int”的成员函数
1>生成日志保存在“file://e:\C语言\第五章作业\TEMP\TEMP\Debug\BuildLog.htm”
1>TEMP - 6 个错误,1 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
这是VS下的结果,哪里错了,该知道了吧本回答被提问者采纳
相似回答