friartuck
friartuck

Reputation: 3121

Creating a vector<MyClass>

I need to basically create a list of MyClass objects. I thought the best way of doing this would be to write vector<MyClass> myClassList; however when compiling I am presented with the following error

error C2065: 'MyClass' : undeclared identifier

Why is this so? c++

Thanks Thomas

Upvotes: 0

Views: 271

Answers (1)

James McNellis
James McNellis

Reputation: 355069

I need to basically create a list of myClass objects

error C2065: 'MyClass' : undeclared identifier

Well, which is it? myClass or MyClass?

In any case, this error message means, as it says, that MyClass has not yet been declared. You need to define your class before you use it. You either haven't defined it or you've forgotten to include the right headers, or you have made some similar error.

Upvotes: 3

Related Questions