有似乎是MySQL的C-API和boost :: ASIO之间的窗口报头的冲突。

如果我包括MySQL的第一I得到:

  

升压/ ASIO /细节/ socket_types.hpp(27):致命错误C1189:#ERROR:WINSOCK.H已经被包含

#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
# if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
#  error WinSock.h has already been included
# endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)

如果包括我的boost :: ASIO首先我得到:

  

包括\设置-win.h(24):警告C4005: '_WIN32_WINNT':宏重新定义

/* Defines for Win32 to make it compatible for MySQL */
#ifdef __WIN2000__
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT     0x0500
#else
/* Get NT 4.0 functions */
#define _WIN32_WINNT     0x0400
#endif

有没有一些解决这个办法,为什么是MySQL的试图迫使Windows版本和提升试图强制执行,它包括反正Winsock的自身?

有帮助吗?

解决方案

在宏重新定义只是一个警告。您的代码应该仍然编译和链接。 我想你的代码,甚至会没有任何问题的工作。

其他提示

尝试

#include "winsock2.h"

,包括之前的MySQL和boost :: ASIO

如果你不能找到一个办法来解决这个问题,你可以尝试包装MySQL的API的的不透明指针作为最后的手段。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top