Boost::asio winsock and winsock 2 compatibility issue

后端 未结 5 582
难免孤独
难免孤独 2020-12-28 16:57

My project uses windows.h in which winsock.h is used, and I need to include boost:assio which uses winsock2. So I get many errors that says Winsock.h already included. I can

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-28 17:07

    #ifdef BOOST_OS_WINDOWS
    #define _WIN32_WINNT 0x0501
    #if _WIN32_WINNT <= 0x0501
    #define BOOST_ASIO_DISABLE_IOCP
    #define BOOST_ASIO_ENABLE_CANCELIO
    #endif
    #endif
    

提交回复
热议问题