gcc编译c语言调用mysql存储过程代码出现的问题list

67 篇文章 0 订阅
46 篇文章 1 订阅
1.问题:mysql.c:1:19: 错误:mysql/mysql.h:没有那个文件或目录
结局:

原因:没有装 mysql-devel-5.0.22-2.1.i386.rpm

[root@localhost RPMS]#yum install mysql-devel

2.问题:/tmp/ccyHfsX2.o(.text+0x1e): In function `main':
: undefined reference to `mysql_init'
/tmp/ccyHfsX2.o(.text+0x47): In function `main':
: undefined reference to `mysql_real_connect'
/tmp/ccyHfsX2.o(.text+0x76): In function `main':
: undefined reference to `mysql_query'
/tmp/ccyHfsX2.o(.text+0x9a): In function `main':
: undefined reference to `mysql_affected_rows'
/tmp/ccyHfsX2.o(.text+0xbc): In function `main':
: undefined reference to `mysql_error'
/tmp/ccyHfsX2.o(.text+0xcf): In function `main':
: undefined reference to `mysql_errno'
/tmp/ccyHfsX2.o(.text+0xf5): In function `main':
: undefined reference to `mysql_close'
/tmp/ccyHfsX2.o(.text+0x11f): In function `main':
: undefined reference to `mysql_errno'
/tmp/ccyHfsX2.o(.text+0x135): In function `main':
: undefined reference to `mysql_error'
/tmp/ccyHfsX2.o(.text+0x148): In function `main':
: undefined reference to `mysql_errno'
collect2: ld returned 1 exit status
结局:在gcc最后加上-I/usr/include/mysql/ -L/usr/lib/mysql/ `mysql_config --cflags --libs`这句话。
例如:[root@zieckey mysql]# gcc -o insert insert.c -I/usr/include/mysql/ -L/usr/lib/mysql/ `mysql_config --cflags --libs`

3.问题:安装了mysql后在启动service mysql start时显示unrecognized service。

结局:装一个mysql-server就可以了。我是直接yum install mysql-server


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值