I am getting following error while compiling in linux.
file.cxx:283:9: error: reference to ‘multimap’ is ambiguous
file.cxx:273:47: error: candidates are: std::multimap, std::basic_string > multimap
->piece of sample code is
static std::multimap<std::string,std::string> multimap; //line no. 273
//
void foo()
{
if (multimap.size() == 0)
{
multimap.insert( std::pair< std::string, std::string >( "A" , "B" ) );
}
}
Thanks in advance
You probably have using namespace std;
in the file. That means your compiler already knows "multimap", which you are trying to define again, in which case the compiler doesn't know which one you mean.
There is a member function
in std and you inserted it into your namespace. Avoid using using namespace std;
you can import what you need this way:
using std::multimap;
using std::string;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.