gcc,×°ÍêÖ®ºó£¬»¹Òª×°Ò»Ð©Àà¿â£¬Òª²»»á³öºÜ¶à´íÎó
sudo apt-get install g++,glibc,glibc-source,build-essential,libmysql++dev,libmysqlclient15off,libmysqlclient15-dev
ÉÏÃæÕâЩ¶«Î÷£¬ÎÒÒ²²»ÖªµÀÄÄЩÕæÕýÓÐÓ㬷´ÕýÕâЩÎÒ¶¼¸ø×°ÉÏÁË
µÚ¶þ²½£º
ʾÀý³ÌÐò£¨±ðÈ˵ģ©[code]#include
#include
#include
#include
int main(){
MYSQL *mysql;
MYSQL_RES *res;
MYSQL_ROW row;
char query[1024];
int t,r;
mysql=mysql_init(NULL);
if (!mysql_real_connect(mysql,"test","root",
"123","test",0,NULL,0))
{
printf( "Error connecting to database: %s\n",mysql_error(mysql));
}
else printf("Connected...\n");
sprintf(query,"select * from first");
t=mysql_query(mysql,query);
if (t)
{
printf("Error making query: %s\n",
mysql_error(mysql));
}
else printf("Query made...\n");
res=mysql_use_result(mysql);
for(r=0;r
if(row<0) break;
for(t=0;t
printf("\n");
}
mysql_close(mysql);
return 0;
}[/code]È»ºógcc test.c -lmysqlclient
ÁíÍâ#include