开发者

Problem with libraries using winsock.h

I have a project that uses Boost.A开发者_StackOverflow社区sio and the Media-Decoding-Samples that come with the Intel IPP-Library. The problem is the following. If I compile the project without defining WIN32_LEAN_AND_MEAN, Asio complains with the infamous "winsock.h already included" error. If I define the macro, a header in the other library has undefined types, because it relies on windows.h including winsock.h. I tried adding winsock.h to that header manually, but this makes Boost.Asio cry out again. The only solution I can think of would be to go through every compilation unit and make sure that Asio is always included first. Due to the size and complexity of the project (and the uglyness of that solution) I would like to find a better way.

Thanks in advance !


you can get around this if you split up your source and make sure not to use some kind of common header in your application in which you incude both Asio and IPP. So the source files needing Asio include Boost headers, the source files needing IPP include the IPP headers, but the header files for your classes that need to refer to both should not include any external headers, and use forward declarations if needed.


" a header in the other library has undefined types"

How many? How complicated? Perhaps you could define those types?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜