我不会描述,情况和这个贴子差不多,还有几个类似这样的贴子,都没有解决方法。
Hi all,i'm using the mySQL client connecion created by
Andreas Franke, and it works fine on linux, but i can
not be able to make morks on windows.the big problem is that i can't be able to make an
connection from C to mySQL.sincerely i did never had worked in mozart on windows.to use the C api provided by mySQL i did this:
to make a library .a from .libCYGWIN> echo EXPORTS > mysqlclient.defCYGWIN> nm mysqlclient.lib | grep ' T _' | sed 's/.* T
_//' >> mysqlclient.defCYGWIN> dlltool --def mysqlclient.def --dllname
mysqlclient.lib --output-lib libmysql.a
now, to compile a test/***************** test.cc *******************/#include "mysql.h"
#include <stdio.h>int main() { MYSQL * conn = new MYSQL ;
mysql_init( conn ) ;
MYSQL * res = mysql_real_connect( conn,
"localhost",
"root",
"",
"test",
3306,
"",
0 ); if (res != conn) {
printf("connection fails");
} else {
printf("connection works");
} mysql_close(conn);
delete conn;
return 0;
}/******************** end file *****************/
CYGWIN> gcc -o test.exe test.cc -I./include -L./lib
-lmysqlfinally ld can't makes references to 'mysql_init',
'mysq_real_connection' and 'mysql_close'.but CYQWIN> nm libmysql.a | grep mysql_initshows00000000 T _mysql_init at 4 between others.
may be you can to detect my error!!
Hi all,i'm using the mySQL client connecion created by
Andreas Franke, and it works fine on linux, but i can
not be able to make morks on windows.the big problem is that i can't be able to make an
connection from C to mySQL.sincerely i did never had worked in mozart on windows.to use the C api provided by mySQL i did this:
to make a library .a from .libCYGWIN> echo EXPORTS > mysqlclient.defCYGWIN> nm mysqlclient.lib | grep ' T _' | sed 's/.* T
_//' >> mysqlclient.defCYGWIN> dlltool --def mysqlclient.def --dllname
mysqlclient.lib --output-lib libmysql.a
now, to compile a test/***************** test.cc *******************/#include "mysql.h"
#include <stdio.h>int main() { MYSQL * conn = new MYSQL ;
mysql_init( conn ) ;
MYSQL * res = mysql_real_connect( conn,
"localhost",
"root",
"",
"test",
3306,
"",
0 ); if (res != conn) {
printf("connection fails");
} else {
printf("connection works");
} mysql_close(conn);
delete conn;
return 0;
}/******************** end file *****************/
CYGWIN> gcc -o test.exe test.cc -I./include -L./lib
-lmysqlfinally ld can't makes references to 'mysql_init',
'mysq_real_connection' and 'mysql_close'.but CYQWIN> nm libmysql.a | grep mysql_initshows00000000 T _mysql_init at 4 between others.
may be you can to detect my error!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货