namespace confusion ?

L

Lynn

I am including a new header file in a existing function that has
"using namespace std;" defined in it already (from a long time ago).
The new header file has the vector data items specified properly
with the std:: namespace identifier on each.

typedef struct tagFLSDRAWING {
std::vector <STREAM *> hStreams;
std::vector <STRMVERTX *> hVertices;

I am getting the following error messages for the above data structure:
c:\gui\deswin\fs50\VAR.H(83): error C2039: 'vector' : is not a member of 'std'
c:\gui\deswin\fs50\VAR.H(83): error C2143: syntax error : missing ';' before '<'
c:\gui\deswin\fs50\VAR.H(83): error C2501: 'tagFLSDRAWING::vector' : missing storage-class or type specifiers
c:\gui\deswin\fs50\VAR.H(83): error C2238: unexpected token(s) preceding ';'

Is the compiler (MS VC++ 2003) getting confused over the using
namespace command and the "std::" specification ?

Or, am I violating a C++ rule ?

Thanks,
Lynn McGuire
 
V

Victor Bazarov

Lynn said:
I am including a new header file in a existing function that has
"using namespace std;" defined in it already (from a long time ago).
The new header file has the vector data items specified properly
with the std:: namespace identifier on each.

typedef struct tagFLSDRAWING {
std::vector <STREAM *> hStreams;
std::vector <STRMVERTX *> hVertices;

I am getting the following error messages for the above data structure:
c:\gui\deswin\fs50\VAR.H(83): error C2039: 'vector' : is not a member of 'std'

Did you actually include said:
c:\gui\deswin\fs50\VAR.H(83): error C2143: syntax error : missing ';' before '<'
c:\gui\deswin\fs50\VAR.H(83): error C2501: 'tagFLSDRAWING::vector' : missing storage-class or type specifiers
c:\gui\deswin\fs50\VAR.H(83): error C2238: unexpected token(s) preceding ';'

Is the compiler (MS VC++ 2003) getting confused over the using
namespace command and the "std::" specification ?

Or, am I violating a C++ rule ?

Probably.

V
 
L

Lynn

Or, am I violating a C++ rule ?

Yes. The particular C++ source code file did not have the vector header
file in it. Duh !

#include <iostream>
#include <string>
#include <vector>

Thanks,
Lynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top