在Sun OS系统上使用STL map引起冲突的问题

在SunOS系统中使用STL的map时可能会遇到struct map和class map的冲突问题。文章详细介绍了如何通过指定命名空间std来避免此冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Sun OS上,使用STL map时,有时系统会产生struct map 和class map冲突的问题。系统回报如下所示的错误:

/program/netopt/ACE_wrappers/ace/config-sunos5.10.h:64:30: warning: no newline at end of file
test.cpp: In function `int main()':
test.cpp:20: error: use of `map' is ambiguous
/usr/include/net/if.h:99: error: first declared as `struct map' here
/usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/../../../../include/c++/3.4.6/bit
s/stl_map.h:92: error: also declared as `template<class _Key, class _Tp, class
_Compare, class _Alloc> class std::map' here

此时需要在引用mapd的时候,加上命名空间前缀,即使用std::map。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值