编译器错误 C2617

“function”:return 语句不一致

指定的函数没有声明的返回类型,并且之前的 return 语句没有提供值。

下面的示例生成 C2617:

// C2617.cpp
int i;
func() {   // no return type prototype
   if( i ) return;   // no return value
   else return( 1 );   // C2617 detected on this line
}

可能的解决方法:

// C2617b.cpp
// compile with: /c
int i;
int MyF() {
   if (i)
      return 0;
   else
      return (1);
}