Reputation: 313
I am trying to compile a C++ application on SUN server using the compiler Sun C++ 5.9 SunOS_sparc Patch 124863-01.I am getting the below error while compiling
Error: Could not find a match for std::multimap<std::string, OutputNamespace::FUPInfo, std::less<std::string>, std::allocator<std::pair<const std::string, OutputNamespace::FUPInfo>>>::insert(std::pair<std::string, OutputNamespace::FUPInfo>) needed in operator<<(std::ostream &, InvoiceOutput&).
Is this a compiler related issue?do you have any idea how to solve it? Thanks in advance
Regards
Upvotes: 0
Views: 2652
Reputation: 96241
This is a defect in the Sun compiler to maintain backwards ABI compatibility with its original standard library (which lacks very many features). It wants the insert
pair to be the internal value type of the map (with const
) added to the key, rather than the actual key type you've requested in the multimap declaration. For example the following compiles:
#include <map>
#include <string>
int main()
{
std::multimap<std::string, int> mapperizer;
mapperizer.insert(std::pair<const std::string, int>(std::string("Foo"), 42));
}
Also, the original version will compile successfully with stlport4 (command line argument -library=stlport4
).
Upvotes: 3