Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 24-Nov-15 1:11am
v2
Comments
OriginalGriff 22-Nov-15 7:22am    
What error?
Dave Kreskowiak 22-Nov-15 11:28am    
Why is it every time someone posts a "I get an error" question the person doesn't think that the error message is an important piece of information?? It is the MOST IMPORTANT piece of information you can provide!

1 solution

You have not declared the type that the vector should store. You are also trying to return an iterator as an int*.
 
Share this answer
 
Comments
Dipak J Kambale 24-Nov-15 7:12am    
its array of int
Richard MacCutchan 24-Nov-15 7:31am    
No, it is a STL vector, a totally different beast.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900