本文介绍了致命错误mysql.h:在编译期间没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码
#include <my_global.h>
#include <mysql.h>
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
exit(0);
}
当我尝试使用
gcc mysqldb.c -o mysql -I/usr/include/mysql -lmysqlclient
我得到一个错误说致命错误mysql.h:没有这样的文件或目录。如何成功编译和运行代码
i get an error saying fatal error mysql.h:No such file or directory. how can i successfully compile and run the code
推荐答案
检查 / usr / include / mysql / mysql .h
存在。如果您在其他位置安装了(例如 / opt / mysql / include
),使用 -I / opt / mysql / include添加该位置。
Check that /usr/include/mysql/mysql.h
exists. If you have installed the header files somewhere else (say /opt/mysql/include
), add that location with -I/opt/mysql/include.
这篇关于致命错误mysql.h:在编译期间没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!