tags:

views:

92

answers:

4
+9  A: 

Try:

std::vector<int> otherOrder;

vector is part of the std namespace. This means that whenever you use a vector in a header file, you should include the std:: prefix.

The reason that you can sometimes get away with forgetting it is that some included files may have using namespace std; in them, allowing you to leave off the prefix. However, you should avoid the using keyword in header files, for it will pollute the namespace of any files that include it.

For a more detailed explanation of the dangers of using namespace ..., see this thread.

Justin Ardini
[This answer](http://stackoverflow.com/questions/2879555/c-stl-how-to-write-wrappers-for-cout-cerr-cin-and-endl/2880136#2880136) is another argument against `using namespace std`.
sbi
@sbi: Thanks, good argument.
Justin Ardini
Hmmm for some reason I thought my "using namespace std" in main.h would cascade down to taco.h. Thanks for the answer!
Jakobud
@Jakobud: If you had the reverse (`using namespace std;` in `taco.h` but not `main.h`), it would. The only way for it to "cascade" is through `#include`.
Justin Ardini
+2  A: 

Try std::vector<int>. You're supposed to use the namespace --- I'm assuming you have

using namespace std;

in the main.h someplace. There's a lot of talk on SO as to why using using is bad practice ; I'd recommend that you check it out.

Jacob
+3  A: 

All C++ standard library objects live in the std namespace. Try

class MyClass
{

public:
    int someint;
    std::vector<int> myOrder;
//  ^^^^^
};
KennyTM
+1  A: 
std::vector<int> ?
a1ex07