473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

I can't get STL pair to work

#include <utility>
#include <vector>

using namespace std;

vector< pair<int,int v;

Generates an error: ISO C++ forbids declaration of 'vector' with no
type

I'm using MinGW/Dev-C++ compiler. The file "utility" includes
"bits/stl_pair.h", which contains the class pair in the std namespace.
What's wrong?

Thanks,
CK

Oct 25 '06 #1
2 1603
ra*****@gmail.com wrote:
#include <utility>
#include <vector>

using namespace std;

vector< pair<int,int v;

Generates an error: ISO C++ forbids declaration of 'vector' with no
type

I'm using MinGW/Dev-C++ compiler. The file "utility" includes
"bits/stl_pair.h", which contains the class pair in the std namespace.
What's wrong?
No idea. You'll have to do some experimenting. It's not obvious from the
error message that the problem is pair. So try a few things:

pair<int, intp;
vector<intv;

If either of those fails, you've narrowed down the problem.

--

-- Pete

Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." For more information about this book, see
www.petebecker.com/tr1book.
Oct 25 '06 #2
ra*****@gmail.com wrote:
#include <utility>
#include <vector>

using namespace std;

vector< pair<int,int v;

Generates an error: ISO C++ forbids declaration of 'vector' with no
type

I'm using MinGW/Dev-C++ compiler. The file "utility" includes
"bits/stl_pair.h", which contains the class pair in the std namespace.
What's wrong?
Nothing obvious.

Try instantiating a vector<intand a pair<int,intand see which barfs.
--
Ian Collins.
Oct 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Einat d | last post by:
HELP! This code compiles fine on the Solaris and AIX platform but for some reasone fails on the HP 11 platform. Here is the error I'm getting: Error 226: "ClsGetAllRepository.cpp", line 107...
1
by: Einat d | last post by:
HELP! This code compiles fine on the Solaris and AIX platform but for some reasone fails on the HP 11 platform. Here is the error I'm getting: Error 226: "ClsGetAllRepository.cpp", line 107...
3
by: Erik Harris | last post by:
I apologize if this is a stupid question - I'm relatively new to OOP. I have a property that must exist in a class in order to be used by another class. The property, however, does not change with...
4
by: Florent Garcin | last post by:
Hello! I would like to use the map structure with a key of Pair<string, string> and an int as the value. Pair is defined as: template <class T1, class T2> class Pair {
11
by: kietzi | last post by:
Hello world, I was wondering whether it would be possible to create a map which uses a pair of ints as key and a float as value. I have used maps with const char* as key, but have so far not been...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.