0

我正在尝试使用编译器 Sun C++ 5.9 SunOS_sparc Patch 124863-01 在 SUN 服务器上编译 C++ 应用程序。编译时出现以下错误

 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&).

这是与编译器相关的问题吗?您知道如何解决吗?提前致谢

问候

4

1 回答 1

3

这是 Sun 编译器中的一个缺陷,用于保持与其原始标准库(缺少很多特性)的向后 ABI 兼容性。它希望该insert对是const添加到键的映射的内部值类型(带有 ),而不是您在多映射声明中请求的实际键类型。例如以下编译:

#include <map>
#include <string>

int main()
{
    std::multimap<std::string, int> mapperizer;

    mapperizer.insert(std::pair<const std::string, int>(std::string("Foo"), 42));
}

此外,原始版本将使用 stlport4(命令行参数-library=stlport4)成功编译。

于 2013-06-17T18:32:24.117 回答