Mail Archives: djgpp/1996/12/24/00:37:06
Howdy,
I've been testing DJGPP 2.01 with some STL examples from "STL Tutorial
and Reference Guide." When I try to compile the following example:
// Ex02-02.cpp: Demonstrating an STL map.
#include <cstdlib>
#ifdef __GNUC__
# include <iostream.h>
#else
# include <iostream>
#endif
#include <map>
#include <string>
int main()
{
map<string, long, less<string> > directory;
directory["Bogart"] = 1234567;
directory["Bacall"] = 9876543;
directory["Cagney"] = 3459876;
// etc.
// Read some names and look up their numbers.
string name;
while (cin >> name)
if (directory.find(name) != directory.end())
cout << "The phone number for " << name
<< " is " << directory[name] << "\n";
else
cout << "Sorry, no listing for " << name << "\n";
return EXIT_SUCCESS;
}
With the following command:
gxx Ex02-02.cpp
I get the following errors:
In file included from d:/djgpp/lang/cxx/std/bastring.h:571,
from d:/djgpp/lang/cxx/std/string.h:6,
from d:/djgpp/lang/cxx/string:5,
from Ex02-02.cpp:10:
d:/djgpp/lang/cxx/std/sinst.h:60: ambiguous template instantiation for
`operator !=(const char *, const
basic_string<char,string_char_traits<char> > &)' requested
d:/djgpp/lang/cxx/std/sinst.h:60: ambiguous template instantiation for
`operator !=(const basic_string<char,string_char_traits<char> > &, const
char *)' requested
d:/djgpp/lang/cxx/std/sinst.h:62: ambiguous template instantiation for
`operator >(const char *, const
basic_string<char,string_char_traits<char> > &)' requested
d:/djgpp/lang/cxx/std/sinst.h:62: ambiguous template instantiation for
`operator >(const basic_string<char,string_char_traits<char> > &, const
char *)' requested
d:/djgpp/lang/cxx/std/sinst.h:63: ambiguous template instantiation for
`operator <=(const char *, const
basic_string<char,string_char_traits<char> > &)' requested
d:/djgpp/lang/cxx/std/sinst.h:63: ambiguous template instantiation for
`operator <=(const basic_string<char,string_char_traits<char> > &, const
char *)' requested
d:/djgpp/lang/cxx/std/sinst.h:64: ambiguous template instantiation for
`operator >=(const char *, const
basic_string<char,string_char_traits<char> > &)' requested
d:/djgpp/lang/cxx/std/sinst.h:64: ambiguous template instantiation for
`operator >=(const basic_string<char,string_char_traits<char> > &, const
char *)' requested
What's wrong?
Thanks in advance....
-- Randy
====================================================================
Randy Merkel o-
NAR #65722 SR
rmerkel AT ACM DOT org
- Raw text -