STL strange problem

M

Mike Durham

Hi all,
I have a problem with the Linux STL (I think!)
Can anyone explain why I get the error indicated below?

BTW if I use the <vector.h> (backward version) it compiles without
error. I just get a warning that I'm using the old STL.

Thanks, Mike


//#include <vector.h> // compiles ok
#include <vector> // compiles NOT ok

typedef bool (*FPTR_bool_pvoid)(void *);

typedef struct _THandler
{
_THandler() : InUse(false) {}

bool InUse;
int Block;
UINT CurTick;
UINT CountInit;
void *pThis;
FPTR_bool_pvoid pFunc;
} THandler;

// THE ERROR IS HERE
typedef vector<THandler*> THandlerList;
// ERROR: expected initializer before '<' token
 
A

Andre Kostur

Hi all,
I have a problem with the Linux STL (I think!)
Can anyone explain why I get the error indicated below?

BTW if I use the <vector.h> (backward version) it compiles without
error. I just get a warning that I'm using the old STL.

Thanks, Mike

//#include <vector.h> // compiles ok
#include <vector> // compiles NOT ok

..
..
..
// THE ERROR IS HERE
typedef vector<THandler*> THandlerList;
// ERROR: expected initializer before '<' token

Try:

typedef std::vector<THandler*> THandlerList;

Note that the Standard C++ library is in the std:: namespace....
 
M

Mike Durham

Andre said:
@nnrp.waia.asn.au:




Try:

typedef std::vector<THandler*> THandlerList;

Note that the Standard C++ library is in the std:: namespace....

Thanks, that fixed it.

Mike
 
S

Sumit Rajan

Mike Durham said:
Hi all,
I have a problem with the Linux STL (I think!)
Can anyone explain why I get the error indicated below?

BTW if I use the <vector.h> (backward version) it compiles without error.
I just get a warning that I'm using the old STL.

Thanks, Mike


//#include <vector.h> // compiles ok
#include <vector> // compiles NOT ok

typedef bool (*FPTR_bool_pvoid)(void *);

typedef struct _THandler
{
_THandler() : InUse(false) {}

bool InUse;
int Block;
UINT CurTick;
UINT CountInit;
void *pThis;
FPTR_bool_pvoid pFunc;
} THandler;

// THE ERROR IS HERE
typedef vector<THandler*> THandlerList;
// ERROR: expected initializer before '<' token

You would probably find these useful:
http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.4
http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.5

Regards,
Sumit.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,459
Latest member
Vida00R129

Latest Threads

Top