This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: STL multimap g++ compiler error?


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.
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]