Share via


編譯器錯誤 C2562

'identifier' : 'void' 函式傳回一個值

這個函式宣告為 void,但傳回一個值。

這項錯誤可能是因不正確函式原型而造成。

如果在函式宣告中指定傳回型別,可能會修正錯誤。

下列範例會產生 C2562:

// C2562.cpp
// compile with: /c
void testfunc() {
   int i;
   return i;   // C2562 delete the return to resolve
}