I tried to write my code, and it looks like something like this (i cut some of them to make it readable).

class TimeSeriesDatum
{
public:	
	TimeSeriesDatum();
	//TimeSeriesDatum( double = 0, int = 0, string = "");	
	TimeSeriesDatum( double, int, string );
	
	// getter, setter...
private:
	double value;
};

// in the main
vector<TimeSeriesDatum> myvector;
[B]vector<TimeSeriesDatum>::iterator it;[/B] // 4 errors in this line

And i've got 4 errors for the bold lines in my code, i wonder why. If you have ever had the same problem, can you let me know the solutions?

The errors are:
1) error C2653: 'vector<class TimeSeriesDatum,class std::allocator<class TimeSeriesDatum> >' : is not a class or namespace name
2) error C2065: 'iterator' : undeclared identifier
3) error C2146: syntax error : missing ';' before identifier 'it'
4) error C2065: 'it' : undeclared identifier

Thank you for your attention. I'll wait for your reply.

My guess is that you forgot to include <vector> and/or using std::vector; statement

yes, finally i found it.
I had this before:

// coding A
#include <vector>
using std::vector;

and i changed it to:

// coding B
#include <vector>
using namespace std;

and it produced no error. but i wonder why when i add another using statement, i.e. "using std::vector::iterator;" in coding B, also produced errors?

Thx.

probably something else wrong with your program because this one compiles ok. using std::vector::iterator -- no such thing.

#include <string>
#include <vector>
using std::vector;

using std::string;

int main()
{
    vector<string> v;
    vector<string>::iterator it;
}

thx for your answer. yes, it's maybe because i tried to use visual C++ 6.0 at windows vista. hope that it won't be much different with the one at windows xp.

ditch that compiler because it doesn't implement c++ very well. Better to get newest free Visual C++ 2008 Express -- you can download it free from Microsoft.

>>because i tried to use visual C++ 6.0 at windows vista
That's not the problem -- the problem is the compiler itself.

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.