* STL multimap g++ compiler error?
@ 2009-07-27 3:46 susan_in_california
2009-07-27 4:07 ` Brian Budge
0 siblings, 1 reply; 3+ messages in thread
From: susan_in_california @ 2009-07-27 3:46 UTC (permalink / raw)
To: gcc-help
Hello, everyone! I am seeing something strange with the STL multimap class. I
copy the following lines right from the tutorial:
multimap<char,int> mymultimap;
// first insert function version (single parameter):
mymultimap.insert ( pair<char,int>('a',100) );
and I see the following error when I try to compile:
g++ -Wall -O2 -DNDEBUG -I/usr/include
-I/home/sm19/library/gmp-4.3.1/mygmp/include
-L/home/sm19/library/gmp-4.3.1/mygmp/lib -c cun_gel.cpp
cun_gel.cpp: In member function âbool cun_gel::construct_leaf_BX(int)â:
cun_gel.cpp:653: error: expected primary-expression before âcharâ
cun_gel.cpp:653: error: expected primary-expression before âintâ
I wonder if anyone can help? Perhaps there is something with my compiler
flags? I am including the <map> header file, but perhaps I ought to be
including something else as well?
Thanks for responses, as always!
Best,
Susan
--
View this message in context: http://www.nabble.com/STL-multimap-g%2B%2B-compiler-error--tp24673178p24673178.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: STL multimap g++ compiler error?
2009-07-27 3:46 STL multimap g++ compiler error? susan_in_california
@ 2009-07-27 4:07 ` Brian Budge
2009-07-27 5:06 ` susan_in_california
0 siblings, 1 reply; 3+ messages in thread
From: Brian Budge @ 2009-07-27 4:07 UTC (permalink / raw)
To: susan_in_california; +Cc: gcc-help
Hi -
This might be more appropriate to post to a C++ forum, but you are
probably missing the namespace "using" declaration. You need to let
the compiler know that both multimap and pair are in namespace std.
Brian
On Sun, Jul 26, 2009 at 8:45 PM,
susan_in_california<bajichuan@hotmail.com> wrote:
>
> Hello, everyone! I am seeing something strange with the STL multimap class. I
> copy the following lines right from the tutorial:
>
> multimap<char,int> mymultimap;
>
> // first insert function version (single parameter):
> mymultimap.insert ( pair<char,int>('a',100) );
>
> and I see the following error when I try to compile:
>
> g++ -Wall -O2 -DNDEBUG -I/usr/include
> -I/home/sm19/library/gmp-4.3.1/mygmp/include
> -L/home/sm19/library/gmp-4.3.1/mygmp/lib -c cun_gel.cpp
> cun_gel.cpp: In member function âbool cun_gel::construct_leaf_BX(int)â:
> cun_gel.cpp:653: error: expected primary-expression before âcharâ
> cun_gel.cpp:653: error: expected primary-expression before âintâ
>
> I wonder if anyone can help? Perhaps there is something with my compiler
> flags? I am including the <map> header file, but perhaps I ought to be
> including something else as well?
>
> Thanks for responses, as always!
>
> Best,
> Susan
> --
> View this message in context: http://www.nabble.com/STL-multimap-g%2B%2B-compiler-error--tp24673178p24673178.html
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: STL multimap g++ compiler error?
2009-07-27 4:07 ` Brian Budge
@ 2009-07-27 5:06 ` susan_in_california
0 siblings, 0 replies; 3+ messages in thread
From: susan_in_california @ 2009-07-27 5:06 UTC (permalink / raw)
To: gcc-help
Sorry for the mis-post! Your comment definitely put me on the right track. I
was already "using namespace std;", but adding
mymultimap.insert ( std::pair<char,int>('a',100) );
did the trick. Thanks for responding, even though the forum wasn't quite
right!
Best,
Susan
--
View this message in context: http://www.nabble.com/STL-multimap-g%2B%2B-compiler-error--tp24673178p24673644.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-27 5:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-27 3:46 STL multimap g++ compiler error? susan_in_california
2009-07-27 4:07 ` Brian Budge
2009-07-27 5:06 ` susan_in_california
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).