c++ - CREATESTRUCT 错误 C4430 : missing type specifier - int assumed. 注意 : C++ does not support default-int c:\x\dcd\dcdchild. h 22 1

标签 c++ visual-studio-2010

我正在尝试修改用旧版本的 Visual Studio 编写的项目。我现在使用 Visual Studio 2010。当我打开项目时,它会自动转换为 2010 格式。但是,当我构建它时出现以下错误:

Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support 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。问题是,我该如何解决?

最佳答案

声明 virtual CDCDChildWnd::PreCreateWindow(CREATESTRUCT& cs); 无效。它应该是这样的:

virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

关于c++ - CREATESTRUCT 错误 C4430 : missing type specifier - int assumed. 注意 : C++ does not support default-int c:\x\dcd\dcdchild. h 22 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29278256/

相关文章:

c++ - QFormLayout 中的 QSpacerItem - 垂直展开

c++ - 未定义 对 "_ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb"符号的引用未从 libstdc++.a(libstdc++.so.6) 导出

c++ - Visual C++ 2010 和 native 可执行文件

Python PIP 在 Windows 7 上安装 64 位 MS Visual Studio 2010 Express 的路径存在问题

c++ - VS10 C++ 错误 C2833 : 'operator string' is not a recognized operator or type

c++ - 为什么 C/C++ 程序在 Debug模式下经常会关闭优化?

c++ - 0x800a1421 HRESULT 是什么意思?

sql-server - Visual Studio 2010 和 SQL Server

c++ - 使用 STL utility.h 重载运算符

c++ - CUDA - OpenCV - Visual Studio 2010 中的 C++ 链接错误