免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1539 | 回复: 1
打印 上一主题 下一主题

求助一个C连接Mysql的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-05-12 16:32 |只看该作者 |倒序浏览
编译命令:
gcc test.c -o test -I/home/zorro/soft/libmysql/include -L/home/zorro/soft/libmysql/lib -static -lmysqlclient -lpthread -lm

可以编译成功,但是会产生以下警告:
  1. /home/zorro/soft/libmysql/lib/libmysqlclient.a(mf_pack.c.o): In function `expand_tilde':
  2.     /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/mf_pack.c:390: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  3.     /home/zorro/soft/libmysql/lib/libmysqlclient.a(libmysql.c.o): In function `read_user_name':
  4.     /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:508: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  5.     /home/zorro/soft/libmysql/lib/libmysqlclient.a(mf_pack.c.o): In function `expand_tilde':
  6.     /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/mf_pack.c:392: warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  7.     /home/zorro/soft/libmysql/lib/libmysqlclient.a(client.c.o): In function `mysql_real_connect':
  8.     /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2153: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  9.     /home/zorro/soft/libmysql/lib/libmysqlclient.a(libmysql.c.o): In function `mysql_server_init':
  10.     /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:148: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
复制代码

论坛徽章:
2
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:53:17
2 [报告]
发表于 2012-05-12 17:20 |只看该作者
简单点,别用-static
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP