gamehack wrote:
Hi all,
Here's the error which I'm getting when trying to compile some code:
- boxmanager.h:16: error: ISO C++ forbids declaration of 'vector'
- with no type
- boxmanager.h:16: error: expected ';' before '<' token
- boxmanager.h:17: error: ISO C++ forbids declaration of 'vector'
- with no type
- boxmanager.h:17: error: expected ';' before '<' token
-
And the code is:
- private:
- vector<Box> boxes; // line 16
- vector<int> chosenmoney; // line 17
-
I'm doing some silly mistake but cannot see what it is. Thanks.
Three errors that I see.
1. Failure to post complete, compilable code. See Sec. 5.8 of the
FAQ.
2. Failure to include the proper header (#include <vector>) - unless,
of course, it's in the code you forgot to post.
3. Failure to qualify your reference to vector. It's std::vector
(unless you've previously included: using std::vector;
And please don't put "using namespace std;" in the header file (just in
case you were tempted).
Best regards,
Tom