473,503 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 14706
JosAH
11,448 Recognized Expert MVP
Have you defined delayTP, deviceStatus etc. as types before you define that database class?

kind regards,

Jos
Aug 28 '08 #2
samsneelam
4 New Member
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 Contributor
If std::queue works instead?
and semicolon after class ClassName{ ... }; <- here
Aug 28 '08 #4
samsneelam
4 New Member
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 Recognized Expert Contributor
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
samsneelam
4 New Member
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

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

Similar topics

0
1638
by: Zach | last post by:
Using Dev-C++ 4.9.8.5 I get error: Compiler: Default compiler Executing g++.exe... g++.exe "C:\winroot\src\c++\stupid_tricks\functor_trick.cpp" -o...
11
2405
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
67
4192
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
4
10351
by: James | last post by:
Can someone please help me with these errors? #include <iostream> #include <string> class holder { private: int vid; string vtype;
12
5683
by: arnuld | last post by:
in C++ Primer 4/3 Lippman says in chapter 3, section 3.3.1: vector<stringsvec(10); // 10 elements, each an empty string here is the the code output & output from my Debian box running "gcc...
7
3286
by: i | last post by:
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> char ch; int w; int n,m; //void main(); char check(int n,int m,char ch); void cash(int n,int m,char ch);
2
3078
by: brasewel | last post by:
Hi guys, I'm getting an error i cannot figure. Here is my code Header file ------------------------------------------------------------------------------------------- #ifndef Clock_H #define...
2
1460
Ganon11
by: Ganon11 | last post by:
When I try and compile my code, I'm getting the error: In file included from HTTest.cpp:2: HashTable.h:52: error: ISO C++ forbids declaration of `vector' with no type Line 52 from my program is:...
3
3980
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.