Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 28th, 2008, 11:17 AM
Newbie
 
Join Date: Aug 2008
Posts: 4
Default 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...
Reply
  #2  
Old August 28th, 2008, 11:22 AM
Moderator
 
Join Date: Mar 2007
Location: Voorschoten, the Netherlands
Age: 52
Posts: 8,460
Default

Have you defined delayTP, deviceStatus etc. as types before you define that database class?

kind regards,

Jos
Reply
  #3  
Old August 28th, 2008, 12:24 PM
Newbie
 
Join Date: Aug 2008
Posts: 4
Default

Quote:
Originally Posted by JosAH
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
Reply
  #4  
Old August 28th, 2008, 12:40 PM
Familiar Sight
 
Join Date: Jul 2008
Posts: 152
Default

If std::queue works instead?
and semicolon after class ClassName{ ... }; <- here

Last edited by newb16; August 28th, 2008 at 12:41 PM. Reason: and...
Reply
  #5  
Old August 28th, 2008, 12:59 PM
Newbie
 
Join Date: Aug 2008
Posts: 4
Default

Quote:
Originally Posted by newb16
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..
Reply
  #6  
Old August 28th, 2008, 02:27 PM
Expert
 
Join Date: Sep 2007
Posts: 846
Default

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.
Reply
  #7  
Old August 28th, 2008, 02:32 PM
Newbie
 
Join Date: Aug 2008
Posts: 4
Default

Quote:
Originally Posted by Laharl
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..
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles