编译器警告 C4430

更新:2007 年 11 月

错误消息

缺少类型说明符 — 假定为 int。注意:C++ 不支持默认 int

对 Visual C++ 2005 执行的编译器一致性工作可能导致此错误:所有声明现在必须显式指定类型;不再假定为 int。有关更多信息,请参见 Visual C++ 2005 编译器中的重大更改

C4430 始终作为错误发出。 可以使用 #pragma warning 或 /wd 关闭此警告;有关更多信息,请参见 warning/w、/Wn、/WX、/Wall、/wln、/wdn、/wen、/won(警告等级)

示例

下面的示例生成 C4430。

// C4430.cpp
// compile with: /c
struct CMyClass {
   CUndeclared m_myClass;  // C4430
   int m_myClass;  // OK
};

typedef struct {
   POINT();   // C4430
   // try the following line instead
   // int POINT();
   unsigned x;
   unsigned y;
} POINT;