You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Friday, December 3rd 2004, 3:47pm

how to include the right <vector> header ?

I'm implementing a new class with Qt. In that class I need the STL vector. But if I include like this:
#include <vector>
I get the following errors:
vmewincfg.h:31: `vector' was not declared in this scope
vmewincfg.h:31: parse error before `>' token
line 31: void xpto1(vector<int>&);

I know that if I include<vector.h> it will wor but I will get a warning about deprecated header. I also know that I can disable this warning with Wno-deprecated.
My question is how to to do it in a clean way (using <vector>)?

Luis Pereira
Luis Pereira



  • "jacek" is male

Posts: 2,729

Location: Warsaw, Poland

  • Send private message


Friday, December 3rd 2004, 4:44pm

RE: how to include the right <vector> header ?

All STL classes are defined inside the "std" namespace. Try using std::vector<Something> or put:

Source code

using namespace std;
in the beginning of your .cpp file (in header files you should use std:: prefix, to avoid identifier collisions).