473,626 Members | 3,304 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<deviceSta tus> dvStatus;
queue<neighborE ntry> neighborConnect ivity;
vector<staticRo ute> stRouteInfo;
vector<ifaceTab le> 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 14715
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;
}dataCommunicat ion;

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

class database {

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

public:
queue<std::stri ng> MesgSendQueue;
queue<string> MesgRecvQueue;
queue<networkSt atus> nwStatus;
queue<dataCommu nication> dComm;
queue<datalinkS tatus> dlStat;
queue<deviceSta tus> 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
1653
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 "C:\winroot\src\c++\stupid_tricks\functor_trick.exe" -I"C:\DEV-CPP\include\c++" -I"C:\DEV-CPP\include\c++\mingw32" -I"C:\DEV-CPP\include\c++\backward" -I"C:\DEV-CPP\include" -L"C:\DEV-CPP\lib" C:/winroot/src/c++/stupid_tricks/functor_trick.cpp: In member function
11
2419
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 to find the _current_ reporting page... // // Since I'm now using much time on reporting this compiler bug, please // do also fix the __LINE__ macro. //
67
4243
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. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
4
10357
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
5701
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 3.3.5": #include <iostream> #include <vector>
7
3308
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
3091
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 Clock_H #include <vector> #include <list>
2
1468
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: vector<list<int> > theLists; As you can see, it clearly has a type. So does list.
3
3987
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; using std::cout; using std::endl;
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8512
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.