Article View: gnu.gcc.bug
Article #5981HELP! Ambiguous template instantiation errors with DJGPP
From: Randy Merkel
Date: Sun, 19 Jan 1997 00:00
Date: Sun, 19 Jan 1997 00:00
84 lines
3441 bytes
3441 bytes
Howdy One and All;
Using DJGPP 2.01 (GNU G++ 2.7.2.1) I'm getting "ambiguous template
instantiation" errors for basic_string's
synthisied operators, i.e., !=, >, <=, and so on. Can GNU G++ handle
<string>? My program follows (From the "STL Tutorial and Reference
Guide, Musser and Saini":
// 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;
}
I'm using the following command line:
D:\Randys\Programing\STL> gxx -O -fhandle-exceptions *.cpp
And Here are the error messages:
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
Note:
* Different combo's of -O -fhandle-exceptions produce the same errors.
* This program compiles under Visual C++ 4.2 w/o error.
* I have received ANY responces on comp.os.msdos.djgpp.
Thanks in advance for the help!
-- Randy
====================================================================
Randy Merkel o-
NAR #65722 SR
rmerkel@ACM.org
Technical Details
Message-ID:
<32E26A81.4200@postoffice.worldnet.att.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,c184ef0f028966b4,start X-Google-Attributes: gid113d02,public From: Randy-Merkel@postoffice.worldnet.att.net (Randy Merkel) Subject: HELP! Ambiguous template instantiation errors with DJGPP Date: 1997/01/19 Message-ID: <32E26A81.4200@postoffice.worldnet.att.net> X-Deja-AN: 210869929 sender: bug-gcc-request@prep.ai.mit.edu content-type: text/plain; charset=us-ascii organization: Clover Software x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Sun, 19 Jan 1997 13:41:45 EST mime-version: 1.0 reply-to: rmerkel@acm.org newsgroups: gnu.gcc.bug x-mailer: Mozilla 3.01 (Win95; I)