From: Randy Merkel Newsgroups: comp.os.msdos.djgpp Subject: ambiguous template instantiation for basic_string Date: Mon, 30 Dec 1996 10:11:16 -0800 Organization: Clover Software Lines: 97 Message-ID: <32C805A6.7BD4@postoffice.worldnet.att.net> Reply-To: Randy-Merkel AT postoffice DOT worldnet DOT att DOT net NNTP-Posting-Host: 207.147.204.51 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: randy_merkel AT compuserve DOT com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Howdy One and All; I posted a message about this problem a week or so ago, but what with the holidays and all I think I missed any replys. So I'll try again! ;) I'm getting "ambiguous template instantiation" errors for basic_string's synthisied operators, i.e., !=, >, <=, and so on. My program follows (From the "STL Tutorial and Reference Guide, Musser and Saini": // Demonstrating an STL map. #include #ifdef __GNUC__ # include #else # include #endif #include #include int main() { map > 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; } Here is my command line and error messages: D:\Usr\Randy\Programming\STL\book\Examples\ex02_02>gxx -O -fhandle-exceptions *.cpp 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 > &)' requested d:/djgpp/lang/cxx/std/sinst.h:60: ambiguous template instantiation for `operator !=(const basic_string > &, const char *)' requested d:/djgpp/lang/cxx/std/sinst.h:62: ambiguous template instantiation for `operator >(const char *, const basic_string > &)' requested d:/djgpp/lang/cxx/std/sinst.h:62: ambiguous template instantiation for `operator >(const basic_string > &, const char *)' requested d:/djgpp/lang/cxx/std/sinst.h:63: ambiguous template instantiation for `operator <=(const char *, const basic_string > &)' requested d:/djgpp/lang/cxx/std/sinst.h:63: ambiguous template instantiation for `operator <=(const basic_string > &, const char *)' requested d:/djgpp/lang/cxx/std/sinst.h:64: ambiguous template instantiation for `operator >=(const char *, const basic_string > &)' requested d:/djgpp/lang/cxx/std/sinst.h:64: ambiguous template instantiation for `operator >=(const basic_string > &, const char *)' requested d:/djgpp/lang/cxx/tree.h: In method `void rb_tree >,pair >,long int>,select1st >,long int>,basic_string > >,less > > >::erase_hack(struct b_tree_iterator >,pair >,long int>,select1st >,long int> ,basic_string > >,less > > >)': d:/djgpp/lang/cxx/tree.h:954: virtual memory exhausted Thanks in advance for the help! -- Randy ==================================================================== Randy Merkel o- NAR #65722 SR rmerkel AT ACM DOT org