Environment: under the Linux distribution of windows system, Ubuntu 20.04.2 lts;
Problem Description: MySQL C API programming, after installing MySQL C development library, sudo apt install default libmysqlclient dev
, compile version. C file: GCC version. C - O version. O
version. C is as follows:
#include <mysql.h>
#include <stdio.h>
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
exit(0);
}
report errors:
version.c:1:10: fatal error: mysql.h: No such file or directory
1 | #include <mysql.h>
Problem reason: no header file path parameter, unable to address
problem modification: Where is MySQL
find mysql. H path: /usr/include/MySQL
recompile: GCC version. C - O version. O - I/usr/include/MySQL
report error again:
/usr/bin/ld: /tmp/ccEn7kBU.o: in function `main':
version.c:(.text+0x14): undefined reference to `mysql_get_client_info'
collect2: error: ld returned 1 exit status
Cause of the problem: no lib parameter is added, so the function cannot be referenced
problem modification: GCC version. C - O version. O - I/usr/include/MySQL - lmysqlclient
problem solving.
Read More:
- gcc /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
- #During OpenGL development, fatal error C1083: can’t open include file: “GL / glut. H”: no such file or directory
- fatal error: Python.h: No such file or directory
- fatal error: Python.h: No such file or directory
- fatal error: Python.h: No such file or directory compilation terminated.
- Fatal error in CentOS: Python. H: no that file or directory
- fatal error: openssl/bio.h: No such file or directory settlement programme
- [Solved] Docker ubuntu swoole fatal error: openssl/ssl.h: No such file or directory
- Linux QT download / usr / include / C + + / 7/ cstdlib:75 : 15: fatal error: stdlib. H: no such file or directory error
- [Caffe] fatal error: hdf5.h: No such file or directory error solution
- Compiling the pi_kernel source code appears: fatal error: openssl/opensslv.h: No such file or directory
- RCurl error-fatal error: curl/curl.h: No such file or directory
- caffe deep learning [three] compilation error: fatal error: hdf5.h: No such file or directory compilation terminated.
- A fatal error C1083 occurred when compiling C + + code under. Net: unable to open the include file: “xuhk”_ Jnihelloworld. H “: solution to no such file or directory error.
- VS2010 compiler can’t open include file: “GL / glaux. H”: no such file or directory
- In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory
- Cannot open include file: ‘io.h‘: No such file or directory
- 【linux】error: stdio.h: No such file or directory
- Solution of header file StdAfx. H “no such file or directory” in Visual Studio
- Error: libipq. H: no such file or directory solution