当前位置: 技术问答>linux和unix
linux里c语言连接mysql的问题
来源: 互联网 发布时间:2016-04-03
本文导语: gcc -Wall 1.c -L /usr/lib/dbd -l dbdmysql 出以下错误,请问什么原因?谢谢 /usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_set_numfields' /usr/lib/dbd/libmysql.so: undefined reference to `_dbd_row_allocate' /usr/lib/dbd/libmysql.so: undefined...
gcc -Wall 1.c -L /usr/lib/dbd -l dbdmysql
出以下错误,请问什么原因?谢谢
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_set_numfields'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_row_allocate'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_create'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_row_finalize'
/usr/lib/dbd/libmysql.so: undefined reference to `_error_handler'
/usr/lib/dbd/libmysql.so: undefined reference to `dbi_conn_get_option'
/usr/lib/dbd/libmysql.so: undefined reference to `dbi_conn_get_option_numeric'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_add_field'
/usr/lib/dbd/libmysql.so: undefined reference to `_isolate_attrib'
我grep了一下发现 `_dbd_row_allocate' 等一堆函数确实是在/dbd/libmysql.so 里的
出以下错误,请问什么原因?谢谢
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_set_numfields'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_row_allocate'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_create'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_row_finalize'
/usr/lib/dbd/libmysql.so: undefined reference to `_error_handler'
/usr/lib/dbd/libmysql.so: undefined reference to `dbi_conn_get_option'
/usr/lib/dbd/libmysql.so: undefined reference to `dbi_conn_get_option_numeric'
/usr/lib/dbd/libmysql.so: undefined reference to `_dbd_result_add_field'
/usr/lib/dbd/libmysql.so: undefined reference to `_isolate_attrib'
我grep了一下发现 `_dbd_row_allocate' 等一堆函数确实是在/dbd/libmysql.so 里的
|
你的参数没写对吧
gcc -Wall 1.c -L/usr/include/mysql -lmysqlclient
gcc -Wall 1.c -L/usr/include/mysql -lmysqlclient
|
#include "mysql.h"???
|
你装了mysql的开发包没?
你的代码里添加了mysql.h头文件了没?
你的代码里添加了mysql.h头文件了没?
|
那应该用 -lmysql才对