
rickocam10
(usa Ubuntu)
Enviado em 19/02/2012 - 17:22h
Por favor,
Alguém poderia me ajudar.
Não estou conseguindo conectar um programa em C com o MySQL no Ubuntu.
Já tentei até com um simples programa e não foi.
Segue o código:
#include <stdio.h>
#include <mysql/mysql.h>
void main(void)
{
MYSQL conexao;
mysql_init(&conexao);
mysql_real_connect(&conexao, "localhost", "guest", "guest", "teste", 0, NULL, 0);
printf("conectado com sucesso!\n");
mysql_close(&conexao);
}
Segue o erro abaixo.
/tmp/ccBdrg9q.o: In function `main':
teste.c:(.text+0x23): undefined reference to `mysql_init'
teste.c:(.text+0x67): undefined reference to `mysql_real_connect'
teste.c:(.text+0x7f): undefined reference to `mysql_close'
collect2: ld returned 1 exit status
Desde já agradeço.