Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 10330  / 2 Years ago, thu, january 20, 2022, 2:37:25

I have the following code



#include <my_global.h>
#include <mysql.h>

int main(int argc, char **argv)
{
printf("MySQL client version: %s
", 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


More From » compiling

 Answers
2

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.


[#27756] Thursday, January 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aslity

Total Points: 336
Total Questions: 133
Total Answers: 98

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
aslity questions
Sat, Apr 22, 23, 23:22, 1 Year ago
Wed, Oct 27, 21, 06:19, 3 Years ago
Sun, Oct 3, 21, 05:33, 3 Years ago
Fri, Jul 1, 22, 17:16, 2 Years ago
;