visual studio 2010错误帮助需要 [英] visual studio 2010 error help needed

查看:70
本文介绍了visual studio 2010错误帮助需要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下函数在VC ++ 6.0中编译到visual studio 2005

但是它在visual studio 2010中给出了编译错误。请让我知道如何解决这个编译错误。功能如下:



std :: vector< int> mVals;



int * ReturnInt()

{

mVals.push_back(100);

mVals.push_back(200);

返回mVals.begin()

}



此代码在vc ++ 6.0和visual studio 2005中进行编译。

它在visual studio 2010中出现编译错误。

请告诉我如何解决此问题。



谢谢和问候,

Dipak

I have following function which is compiling in VC++ 6.0 upto visual studio 2005
But its giving compilation error in visual studio 2010. Please let me know how to resolve this compilation error. Function is as follow:

std::vector< int > mVals;

int* ReturnInt()
{
mVals.push_back(100);
mVals.push_back(200);
return mVals.begin()
}

This code is compiling in vc++ 6.0 and visual studio 2005.
It gives compilation error in visual studio 2010.
Please let me know how to resolve this.

Thanks & Regards,
Dipak

推荐答案

你还没有声明那种类型矢量应该存储。您还尝试将迭代器作为int *返回。
You have not declared the type that the vector should store. You are also trying to return an iterator as an int*.


这篇关于visual studio 2010错误帮助需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆