简体   繁体   English

使用 non_blocking() 提升 1.47 编译错误

[英]boost 1.47 compile error with non_blocking()

Can anyone discern what I'm doing wrong here?谁能看出我在这里做错了什么? According to the documentation in 1.47 basic_datagram_socket inherits from basic_socket so the non_blocking() or non_blocking(bool) should be inherited.根据 1.47 中的文档,basic_datagram_socket 继承自 basic_socket,因此应该继承 non_blocking() 或 non_blocking(bool)。 Thanks谢谢

Error 1 error C2039: 'non_blocking': is not a member of 'boost::asio::basic_datagram_socket' c:\DEV\projects\topoTest\topoTest\multiReceiver.cpp 129错误 1 错误 C2039: 'non_blocking': is not a member of 'boost::asio::basic_datagram_socket' c:\DEV\projects\topoTest\topoTest\multiReceiver.cpp 129

This is the call.这是电话。 socket_.non_blocking(true); socket_.non_blocking(true);

and the socket is defined as follows within a class:并且套接字在 class 中定义如下:

boost::asio::ip::udp::socket socket_; boost::asio::ip::udp::socket socket_;

The member function boost::asio::ip::udp::socket::non_blocking() appears to be new in 1.47.成员 function boost::asio::ip::udp::socket::non_blocking()似乎是 1.47 中的新成员。 Either it doesn't actually exist in 1.47 or you're actually using an older header.要么它实际上不存在于 1.47 中,要么你实际上使用的是较旧的 header。 I'd suggest finding the <boost/asio/basic_datagram_socket.hpp> header that's being included to see if it actually has that member function as part of the basic_datagram_socket class.我建议找到<boost/asio/basic_datagram_socket.hpp> header 以查看它是否实际上具有该成员 function 作为basic_datagram_socket ZA2F22ED4F8EBC2ABCB129 的一部分If not, you can always do it the old way like Steve Townsend said in his answer.如果没有,你总是可以像史蒂夫汤森在他的回答中所说的那样用老方法来做。

I just downloaded Boost 1.47 and found that basic_datagram_socket inherits non_blocking() from basic_socket .我刚刚下载了 Boost 1.47,发现basic_datagram_socket basic_socket non_blocking() It looks to me like you don't actually have Boost 1.47.在我看来,您实际上并没有 Boost 1.47。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM