Excuse me, could someone help me?
This code from an ebook and it isn’t wrong but it gives an error while being compiled. I don’t understand what error it is.
error C2653: 'vector<int,class std::allocator<int> >' : is not a class or namespace name

#include<vector>
using std::vector;

int main()
{
	vector<int> a;
	vector<int>::iterator iter = a.begin();
	return 0;
}

I tried another ways and this way works. I don’t know what happens to it.

#include<vector>

int main()
{
	std::vector<int> a;
	std::vector<int>::iterator iter = a.begin();
	return 0;
}

Recommended Answers

All 6 Replies

What compiler are you using?

Works fine with VC++ 2005/2008

>Works fine with VC++ 2005/2008
As it should. The code is correct, but I'm willing to bet that this is yet another bug in Visual C++ 6.0.

The compiler i use is "Microsoft Visual C++ 6.0 Enterprise Edition" ^^. Please help me >"<.

As Narue already told you: this is probably a bug in the (old) vc6 compiler. So the solution would be to download something newer, like Visual Studio 2008 express (free)

Thank masters! I really like the word "FREE" ^^.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.