将 C 程序连接到 MYSQL 数据库时出错 [英] Error while connecting C program to MYSQL database
本文介绍了将 C 程序连接到 MYSQL 数据库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试连接到我的数据库时出现错误:
When I try to connect to my database I get an error :
对'mysql_init@4'的未定义引用
undefined reference to 'mysql_init@4'
#include<mysql.h>
int main()
{
MYSQL *con;
con = mysql_init(NULL);
return 0;
}
我使用代码块.有什么问题?
I use code blocks. What is the issue?
推荐答案
未定义引用"暗示链接器错误.在这种情况下,您可能没有链接到正确的 mysql C 库.与适当的 C 库链接.
"Undefined Reference" to something implies a linker error. In this case you are possibly not linking to the right mysql C library. Link with the appropriate C libraries.
此外,在此处
这篇关于将 C 程序连接到 MYSQL 数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文