I have the following code
#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);
}
when i try to compile it using
gcc mysqldb.c -o mysql -I/usr/include/mysql -lmysqlclient
i get an error saying fatal error mysql.h:No such file or directory. how can i successfully compile and run the code
I come across the same error today, turn out that I forget to install package libmysqlclient-dev
. After I install it with
sudo apt install libmysqlclient-dev
the error went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With