我正在尝试在MacOS X上运行blocking_udp_echo_client http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/echo/blocking_udp_echo_client.cpp
我使用参数'localhost 9000'
运行它但程序崩溃了,这是源崩溃的行: `udp :: socket s(io_service,udp :: endpoint(udp :: v4(),0));'
这是堆栈跟踪:
#0 0x918c3e42 in __kill #1 0x918c3e34 in kill$UNIX2003 #2 0x9193623a in raise #3 0x91942679 in abort #4 0x940d96f9 in __gnu_debug::_Error_formatter::_M_error #5 0x0000e76e in __gnu_debug::_Safe_iterator::op_base*> >, __gnu_debug_def::list::op_base*>, std::allocator::op_base*> > > >::_Safe_iterator at safe_iterator.h:124 #6 0x00014729 in boost::asio::detail::hash_map::op_base*>::bucket_type::bucket_type at hash_map.hpp:277 #7 0x00019e97 in std::_Construct::op_base*>::bucket_type, boost::asio::detail::hash_map::op_base*>::bucket_type> at stl_construct.h:81 #8 0x0001a457 in std::__uninitialized_fill_n_aux::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type> at stl_uninitialized.h:194 #9 0x0001a4e1 in std::uninitialized_fill_n::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type> at stl_uninitialized.h:218 #10 0x0001a509 in std::__uninitialized_fill_n_a::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type, boost::asio::detail::hash_map::op_base*>::bucket_type> at stl_uninitialized.h:310 #11 0x0001aa34 in __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::_M_fill_insert at vector.tcc:365 #12 0x0001acda in __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::insert at stl_vector.h:658 #13 0x0001ad81 in __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::resize at stl_vector.h:427 #14 0x0001ae3a in __gnu_debug_def::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::resize at vector:169 #15 0x0001b7be in boost::asio::detail::hash_map::op_base*>::rehash at hash_map.hpp:221 #16 0x0001bbeb in boost::asio::detail::hash_map::op_base*>::hash_map at hash_map.hpp:67 #17 0x0001bc74 in boost::asio::detail::reactor_op_queue::reactor_op_queue at reactor_op_queue.hpp:42 #18 0x0001bd24 in boost::asio::detail::kqueue_reactor::kqueue_reactor at kqueue_reactor.hpp:86 #19 0x0001c000 in boost::asio::detail::service_registry::use_service > at service_registry.hpp:109 #20 0x0001c14d in boost::asio::use_service > at io_service.ipp:195 #21 0x0001c26d in boost::asio::detail::reactive_socket_service >::reactive_socket_service at reactive_socket_service.hpp:111 #22 0x0001c344 in boost::asio::detail::service_registry::use_service > > at service_registry.hpp:109 #23 0x0001c491 in boost::asio::use_service > > at io_service.ipp:195 #24 0x0001c4d5 in boost::asio::datagram_socket_service::datagram_socket_service at datagram_socket_service.hpp:95 #25 0x0001c59e in boost::asio::detail::service_registry::use_service > at service_registry.hpp:109 #26 0x0001c6eb in boost::asio::use_service > at io_service.ipp:195 #27 0x0001c711 in boost::asio::basic_io_object >::basic_io_object at basic_io_object.hpp:72 #28 0x0001c783 in boost::asio::basic_socket >::basic_socket at basic_socket.hpp:108 #29 0x0001c865 in boost::asio::basic_datagram_socket >::basic_datagram_socket at basic_datagram_socket.hpp:107 #30 0x000027bc in main at main.cpp:32
这是gdb输出:
(gdb) continue /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127: error: attempt to copy-construct an iterator from a singular iterator. Objects involved in the operation: iterator "this" @ 0x0x100420 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (mutable iterator); state = singular; } iterator "other" @ 0x0xbfffe8a4 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (mutable iterator); state = singular; } Program received signal: “SIGABRT”. (gdb) continue Program received signal: “?”.
有人知道为什么这个例子不适用于mac osx吗? 谢谢。