salve a tutti....perchè quando cerco di compilare questo codice
codice:
#include <mysql.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
MYSQL _mysql;
mysql_init( &_mysql );
string host = "localhost";
string user = "root";
string password = "";
string db = "" ;
bool connected ;
MYSQL *my = mysql_real_connect( &_mysql, host.c_str(), user.c_str(),password.c_str(),db.c_str(),0,0,0);
if (my) connected = true;
else {
connected = false;
string exc = "Errore di connessione a mysql : " + string( mysql_error( &_mysql ) ) + string( "\n" );
throw exc ;
}
mysql_close ( & _mysql );
return (0);
}
mi da questi strani errori?
xk.cpp
.text+0x2c): undefined reference to `mysql_init'
xk.cpp
.text+0x207): undefined reference to `mysql_real_connect'
xk.cpp
.text+0x22b): undefined reference to `mysql_close'
xk.cpp
.text+0x281): undefined reference to `mysql_error'
collect2: ld returned 1 exit status
Compilation failed.
sembra che nella sintassi non ci siano errori...