简体   繁体   中英

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. '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.

I am using 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 . Refering to this msdn page , you can decide which version to specify, eg 0x0600 for Windows Vista and above. Specify this line before the include statement:

#define _WIN32_WINNT 0x0600

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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