分享方式:


編譯器錯誤 C2032

'identifier' : 函式不能是結構/等位 'structorunion' 的成員

結構或等位具有成員函式,可在 C++ 中允許,但在 C 中則不允許。若要解決錯誤,請編譯為 C++ 程式或移除成員函式。

下列範例會產生 C2032:

// C2032.c
struct z {
   int i;
   void func();   // C2032
};

可能的解決方式:

// C2032b.c
// compile with: /c
struct z {
   int i;
};