Boost::asio winsock and winsock 2 compatibility issue

后端 未结 5 552
难免孤独
难免孤独 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:11

    Try and change the order of includes. Start with boost/asio.hpp and put windows.h after it.

    Usually the writers of any code library solve the compatibility issues but they can do it better if their code is the first to meet the compiler and preprocessor.

    There's a similar issue with ACE, including ace/OS.h before anything else solves it.

提交回复
热议问题