mysql connection error with c. Unknown type name 'SOCKET'

0

I have this code and it is generating an error.

#include <stdio.h>
#include <mysql.h>
#include <windows.h>
#include <sys\socket.h>

void main(void)
{

    //parâmetros para Conexão
    char host[100];
    char user[100];
    char pass[100];
    char db[100];
    char script[500];

    //variáveis para conexão e manipulação dos objetos do banco
    MYSQL *socket;
    MYSQL_RES *resp;
    MYSQL_FIELD *campos;
    MYSQL_ROW linhas;   
}

More information:

Compiler: Orwell Dev-C ++

Operating System: Windows 8 x64

MySQL x32

    
asked by anonymous 31.05.2014 / 17:48

1 answer

1

I was able to find the error, it is necessary to give the socks include before mysql. In my case it looks like this:

#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <mysql.h>
//#include <sys\socket.h>
    
31.05.2014 / 18:02