【发布时间】:2015-03-26 20:28:28
【问题描述】:
我正在尝试修改使用旧版 Visual Studio 编写的项目。我现在使用 Visual Studio 2010。当我打开项目时,它会自动转换为 2010 格式。但是,当我构建它时,我收到以下错误:
错误 1 错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 default-int c:\x\dcd\dcdchild.h 22 1
有问题的文件很小:
// dcdchild.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDCDChildWnd frame
class CDCDChildWnd : public CMDIChildWnd
{
DECLARE_DYNCREATE(CDCDChildWnd)
protected:
CDCDChildWnd(); // protected constructor used by dynamic creation
// Attributes
public:
// Operations
public:
// Implementation
protected:
virtual ~CDCDChildWnd();
virtual CDCDChildWnd::PreCreateWindow(CREATESTRUCT& cs);
// Generated message map functions
//{{AFX_MSG(CDCDChildWnd)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
有问题的行是:
virtual CDCDChildWnd::PreCreateWindow(CREATESTRUCT& cs);
我查阅了 CREATESTRUCT 的定义,它是:
typedef struct tagCREATESTRUCT {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCTSTR lpszName;
LPCTSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCT, *LPCREATESTRUCT;
所以它确实包含变量类型 int。问题是,我该如何解决?
【问题讨论】: