简体   繁体   English

包括boost / asio.hpp抛出错误

[英]Including boost/asio.hpp throwing error

When I use #include in a header file, my program will no longer compile, giving the following error: 'boost::asio::basic_socket<Protocol,StreamSocketService>::cancel': By default, this function always fails with operation_not_supported when used on Windows XP, Windows Server 2003, or earlier. Consult documentation for details. 当我在头文件中使用#include时,我的程序将不再编译,并出现以下错误: 'boost::asio::basic_socket<Protocol,StreamSocketService>::cancel': By default, this function always fails with operation_not_supported when used on Windows XP, Windows Server 2003, or earlier. Consult documentation for details. 'boost::asio::basic_socket<Protocol,StreamSocketService>::cancel': By default, this function always fails with operation_not_supported when used on Windows XP, Windows Server 2003, or earlier. Consult documentation for details.

I am also using websocketpp in this project, if that is relevant - however the error only occurs if I include specifically in my header. 如果相关,我也在该项目中使用websocketpp-但是,仅当我在标题中特别包含该错误时,才会发生错误。

I am using Windows 10, Visual Studio 14. 我正在使用Windows 10,Visual Studio 14。

I'm at a loss as to why this error is occuring. 我不知道为什么会发生此错误。 I do not have to use the library at all, simply include it. 我根本不必使用该库,只需将其包含在内即可。

If you look at the header file, it's checking that _WIN32_WINNT is at least 0x0600 . 如果查看头文件,它将检查_WIN32_WINNT至少为0x0600 Refering to this msdn page , you can decide which version to specify, eg 0x0600 for Windows Vista and above. 参考此msdn页面 ,您可以决定指定哪个版本,例如Windows Vista及更高版本的0x0600 Specify this line before the include statement: 在include语句之前指定此行:

#define _WIN32_WINNT 0x0600

暂无
暂无

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

相关问题 包含后无法运行程序<boost/asio.hpp> - Can't run program after including <boost/asio.hpp> 如何修复“致命错误:boost/asio.hpp:没有这样的文件或目录”? - How to fix "fatal error: boost/asio.hpp: no such file or directory"? CMake 错误:致命错误:如果不使用 find_package() 进行升压,则找不到 boost/asio.hpp - CMake Error: fatal error : boost/asio.hpp not found without using find_package() for boost 错误:C1083:无法打开包含文件:'boost/asio.hpp':没有这样的文件或目录 - error: C1083: Cannot open include file: 'boost/asio.hpp': No such file or directory 如何使用boost / asio.hpp文件g ++一个C ++程序? - How to g++ a C++ program using boost/asio.hpp file? 如何为C ++ Visual Studio 2015安装boost / asio.hpp库 - how to install boost/asio.hpp library for C++ visual studio 2015 添加#include <boost/asio.hpp> 导致“有不同大小”的问题 - Adding #include <boost/asio.hpp> results in “has different size” problems Visual Studio 2010,有一些方法我可以添加一个前缀,例如(C:\\)来#include大量的 <boost/asio.hpp> 头? - Visual Studio 2010, is there some way I can add a prefix e.g. (C:\) to #include a massive amount of <boost/asio.hpp> headers? 文件basic_socket.hpp中的lib boost asio 1.47.0出错 - Error with lib boost asio 1.47.0 in file basic_socket.hpp boost/asio/ssl 抛出“未定义引用”错误 - boost/asio/ssl throwing “undefined reference” error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM