By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,715 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,715 IT Pros & Developers. It's quick & easy.

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

P: 4
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
Share this Question
Share on Google+
6 Replies


Expert 10K+
P: 11,448
Have you defined delayTP, deviceStatus etc. as types before you define that database class?

kind regards,

Jos
Aug 28 '08 #2

P: 4
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

100+
P: 687
If std::queue works instead?
and semicolon after class ClassName{ ... }; <- here
Aug 28 '08 #4

P: 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

Expert 100+
P: 849
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

P: 4
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.