VS2013出现“error c4430缺少类型说明符-假定为int。注意C++不支持默认int

出现“error c4430缺少类型说明符-假定为int。注意C++不支持默认int:

 

出现这种错误的原因,是因为函数没有写返回值。是在VC6.0的工程转为高版本(VS2010)的时候经常出现的;


哪怕在异常语句判断中,该有return 没有写return 也会出错,即使程序运行中没有异常

T& front()                  //T类模板
{
if (c.empty())    
{
throw out_of_range("read a empty queue");
return NULL;                             //这个必须有

//break;


return c.front();     //queue接口
}

猜你喜欢

转载自blog.csdn.net/qq_34793133/article/details/80671805