468,765 Members | 1,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

error: ISO C++ forbids declaration of ‘vector’ with no type

Hi..
This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob..

I am having two files .. one is mpcplib.h it contains the follwing declerations....

#include <queue>
#include <vector>
#include <string>
class database {
queue<delayTP> delayThrouput;
queue<deviceStatus> dvStatus;
queue<neighborEntry> neighborConnectivity;
vector<staticRoute> stRouteInfo;
vector<ifaceTable> ifaceInfo;
}

when i compile i m getting the following error..

mpcplib.h:216: error: ISO C++ forbids declaration of ‘queue’ with no type
mpcplib.h:216: error: expected ‘;’ before ‘<’ token
mpcplib.h:217: error: ISO C++ forbids declaration of ‘queue’ with no type
mpcplib.h:217: error: expected ‘;’ before ‘<’ token
mpcplib.h:218: error: ISO C++ forbids declaration of ‘queue’ with no type
mpcplib.h:218: error: expected ‘;’ before ‘<’ token
mpcplib.h:219: error: ISO C++ forbids declaration of ‘vector’ with no type
mpcplib.h:219: error: expected ‘;’ before ‘<’ token
mpcplib.h:220: error: ISO C++ forbids declaration of ‘vector’ with no type
mpcplib.h:220: error: expected ‘;’ before ‘<’ token
mpcplib.h:221: error: ISO C++ forbids declaration of ‘vector’ with no type
mpcplib.h:221: error: expected ‘;’ before ‘<’ token



COULD ANYBODY HELP ME to get rid of this. I already removed using namespace std in my files.

Thanks in advance...
Aug 28 '08 #1
6 14011
JosAH
11,448 Expert 8TB
Have you defined delayTP, deviceStatus etc. as types before you define that database class?

kind regards,

Jos
Aug 28 '08 #2
Have you defined delayTP, deviceStatus etc. as types before you define that database class?

kind regards,

Jos

YEAH, i already defined them in my file...

Thanks
samuel
Aug 28 '08 #3
newb16
687 512MB
If std::queue works instead?
and semicolon after class ClassName{ ... }; <- here
Aug 28 '08 #4
If std::queue works instead?
and semicolon after class ClassName{ ... }; <- here

No use.. ok let me post my entire file..


#include <queue>
#include <vector>
#include <string>

typedef struct networkStat {
char nodeID;
float responseTime;
char status;
}networkStatus;

typedef struct datalinkStat {
char ifaceID;
char subSID;
char status;
}datalinkStatus;

typedef struct dataCom {
char ifaceID;
char subSID;
long byteCount;
}dataCommunication;

typedef struct deviceStat {
char subSID;
char modemID;
char status;
}deviceStatus;

class database {

private:
int updateTable();
int writeTofile();

public:
queue<std::string> MesgSendQueue;
queue<string> MesgRecvQueue;
queue<networkStatus> nwStatus;
queue<dataCommunication> dComm;
queue<datalinkStatus> dlStat;
queue<deviceStatus> dvStatus;
};



This is the code... i called frm main.cpp like this....

database MDbase;

...............................................

this is the total problem.. pls tell me how to solve this...
thanks in advance..
Aug 28 '08 #5
Laharl
849 Expert 512MB
You have <string> and <std::string>. Something look wrong there? You also do need to add the std:: before all those queue declarations, as you don't have using namespace std anymore.
Aug 28 '08 #6
You have <string> and <std::string>. Something look wrong there? You also do need to add the std:: before all those queue declarations, as you don't have using namespace std anymore.

Ok.. i got it by adding std:: before declaring vector...

thanks alot..
Aug 28 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Zach | last post: by
67 posts views Thread by Steven T. Hatton | last post: by
4 posts views Thread by James | last post: by
12 posts views Thread by arnuld | last post: by
7 posts views Thread by i | last post: by
Ganon11
2 posts views Thread by Ganon11 | last post: by
3 posts views Thread by Hill | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.