分享方式:


編譯器警告 C4430

遺漏類型規範 - 假設為 int。 注意:C++ 不支援 default-int

這個錯誤可能是因為針對 Visual Studio 2005 完成的編譯器一致性工作而產生:所有宣告都必須明確指定類型;不再假設 int。

C4430 一律會發出為錯誤。 您可以使用 或 /wd 關閉此警告 #pragma warning ;如需詳細資訊,請參閱 警告 /w、/W0、/W1、/W2、/W3、/W4、/w1、/w2、/w3、/w4、/Wall、/wd、/we、/wo、/Wv、/WX (警告層級)。

範例

下列範例會產生 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;