OS 为 Windows 7 X64,IDE 为Code::Blocks, 编译器为 mingw64, 使用 mysql,得到错误提示道:
Bash
"SOCKET" does not name a type因为mysql是通过socket连接服务器的.在windows下,需要使用winsocket来连接. 因此需要在include mysql.h前加上
C
#include <winsock2.h>C
#include <winsock2.h>
#include <mysql.h>因为 mysql.h 中需要用到类型 SOCKET 但是在 windows 下需要显示声明
两个include顺序颠倒会导致依然错误
References:
Comments
No comments yet — be the first to write one.