编译前需要sudo yum install mysql-devel。 然后再make。
以下是我的编译过程 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 powerlog2.c: In function ‘main’: powerlog2.c:6:2: error: unknown type name ‘MYSQL’ MYSQL conn; ^ powerlog2.c:13:11: warning: initialization makes integer from pointer without a cast [enabled by default] char sql="INSERT INTO `powerlog` (time) VALUES (now())"; ^ make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/lib/mysql/ -lmysqlclient powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/lib/mysql/ -lmysqlclient powerlog2.c: In function ‘main’: powerlog2.c:7:2: error: unknown type name ‘MYSQL’ MYSQL conn; ^ powerlog2.c:16:11: warning: initialization makes integer from pointer without a cast [enabled by default] char sql="INSERT INTO `powerlog` (time) VALUES (now())"; ^ make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/lib/mysql/ -lmysqlclient powerlog2.c: In function ‘main’: powerlog2.c:7:2: error: unknown type name ‘MYSQL’ MYSQL conn; ^ make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ sudo yum install mysql-devel [sudo] password for octopus: Sorry, try again. [sudo] password for octopus: Loaded plugins: langpacks, refresh-packagekit Cairo-Dock | 2.9 kB 00:00 adobe-linux-x86_64 | 951 B 00:00 google-chrome | 951 B 00:00 google-chrome/primary | 1.9 kB 00:00 google-chrome 3/3 Resolving Dependencies --> Running transaction check ---> Package mariadb-devel.x86_64 1:5.5.31-4.fc19 will be installed --> Processing Dependency: openssl-devel(x86-64) for package: 1:mariadb-devel-5.5.31-4.fc19.x86_64 --> Running transaction check ---> Package openssl-devel.x86_64 1:1.0.1e-4.fc19 will be installed --> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.1e-4.fc19.x86_64 --> Running transaction check ---> Package krb5-devel.x86_64 0:1.11.3-2.fc19 will be installed --> Processing Dependency: libverto-devel for package: krb5-devel-1.11.3-2.fc19.x86_64 --> Processing Dependency: libselinux-devel for package: krb5-devel-1.11.3-2.fc19.x86_64 --> Processing Dependency: libcom_err-devel for package: krb5-devel-1.11.3-2.fc19.x86_64 --> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.11.3-2.fc19.x86_64 --> Running transaction check ---> Package keyutils-libs-devel.x86_64 0:1.5.5-4.fc19 will be installed ---> Package libcom_err-devel.x86_64 0:1.42.7-2.fc19 will be installed ---> Package libselinux-devel.x86_64 0:2.1.13-15.fc19 will be installed --> Processing Dependency: libsepol-devel >= 2.1.9-1 for package: libselinux-devel-2.1.13-15.fc19.x86_64 --> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.1.13-15.fc19.x86_64 ---> Package libverto-devel.x86_64 0:0.2.5-2.fc19 will be installed --> Running transaction check ---> Package libsepol-devel.x86_64 0:2.1.9-1.fc19 will be installed --> Finished Dependency Resolution
Dependencies Resolved
================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mariadb-devel x86_64 1:5.5.31-4.fc19 updates 729 k Installing for dependencies: keyutils-libs-devel x86_64 1.5.5-4.fc19 fedora 34 k krb5-devel x86_64 1.11.3-2.fc19 updates 600 k libcom_err-devel x86_64 1.42.7-2.fc19 fedora 29 k libselinux-devel x86_64 2.1.13-15.fc19 fedora 168 k libsepol-devel x86_64 2.1.9-1.fc19 fedora 70 k libverto-devel x86_64 0.2.5-2.fc19 fedora 11 k openssl-devel x86_64 1:1.0.1e-4.fc19 fedora 1.2 M
Transaction Summary ================================================================================ Install 1 Package (+7 Dependent packages)
Total download size: 2.8 M Installed size: 7.3 M Is this ok [y/d/N]: y Downloading packages: (1/8): keyutils-libs-devel-1.5.5-4.fc19.x86_64.rpm | 34 kB 00:02 (2/8): libverto-devel-0.2.5-2.fc19.x86_64.rpm | 11 kB 00:02 (3/8): libcom_err-devel-1.42.7-2.fc19.x86_64.rpm | 29 kB 00:09 (4/8): libselinux-devel-2.1.13-15.fc19.x86_64.rpm | 168 kB 00:13 (5/8): libsepol-devel-2.1.9-1.fc19.x86_64.rpm | 70 kB 00:14 (6/8): krb5-devel-1.11.3-2.fc19.x86_64.rpm | 600 kB 00:14 (7/8): openssl-devel-1.0.1e-4.fc19.x86_64.rpm | 1.2 MB 00:10 (8/8): mariadb-devel-5.5.31-4.fc19.x86_64.rpm | 729 kB 01:44 -------------------------------------------------------------------------------- Total 26 kB/s | 2.8 MB 01:50 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : keyutils-libs-devel-1.5.5-4.fc19.x86_64 1/8 Installing : libsepol-devel-2.1.9-1.fc19.x86_64 2/8 Installing : libselinux-devel-2.1.13-15.fc19.x86_64 3/8 Installing : libverto-devel-0.2.5-2.fc19.x86_64 4/8 Installing : libcom_err-devel-1.42.7-2.fc19.x86_64 5/8 Installing : krb5-devel-1.11.3-2.fc19.x86_64 6/8 Installing : 1:openssl-devel-1.0.1e-4.fc19.x86_64 7/8 Installing : 1:mariadb-devel-5.5.31-4.fc19.x86_64 8/8 Verifying : 1:openssl-devel-1.0.1e-4.fc19.x86_64 1/8 Verifying : libcom_err-devel-1.42.7-2.fc19.x86_64 2/8 Verifying : libverto-devel-0.2.5-2.fc19.x86_64 3/8 Verifying : libsepol-devel-2.1.9-1.fc19.x86_64 4/8 Verifying : 1:mariadb-devel-5.5.31-4.fc19.x86_64 5/8 Verifying : keyutils-libs-devel-1.5.5-4.fc19.x86_64 6/8 Verifying : libselinux-devel-2.1.13-15.fc19.x86_64 7/8 Verifying : krb5-devel-1.11.3-2.fc19.x86_64 8/8
Installed: mariadb-devel.x86_64 1:5.5.31-4.fc19
Dependency Installed: keyutils-libs-devel.x86_64 0:1.5.5-4.fc19 krb5-devel.x86_64 0:1.11.3-2.fc19 libcom_err-devel.x86_64 0:1.42.7-2.fc19 libselinux-devel.x86_64 0:2.1.13-15.fc19 libsepol-devel.x86_64 0:2.1.9-1.fc19 libverto-devel.x86_64 0:0.2.5-2.fc19 openssl-devel.x86_64 1:1.0.1e-4.fc19
Complete! [octopus@pc3 powerlog]$ sudo yum install mysql-devel Loaded plugins: langpacks, refresh-packagekit Package 1:mariadb-devel-5.5.31-4.fc19.x86_64 already installed and latest version Nothing to do [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/lib/mysql/ -lmysqlclient powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/include/mysql/ -lmysqlclient powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql powerlog2.c: In function ‘main’: powerlog2.c:14:2: warning: passing argument 1 of ‘mysql_query’ from incompatible pointer type [enabled by default] mysql_query("SET NAMES utf8"); ^ In file included from powerlog2.c:3:0: /usr/include/mysql/mysql.h:442:14: note: expected ‘struct MYSQL *’ but argument is of type ‘char *’ int STDCALL mysql_query(MYSQL *mysql, const char *q); ^ powerlog2.c:14:2: error: too few arguments to function ‘mysql_query’ mysql_query("SET NAMES utf8"); ^ In file included from powerlog2.c:3:0: /usr/include/mysql/mysql.h:442:14: note: declared here int STDCALL mysql_query(MYSQL *mysql, const char *q); ^ powerlog2.c:17:2: warning: passing argument 1 of ‘mysql_query’ from incompatible pointer type [enabled by default] mysql_query(sql); ^ In file included from powerlog2.c:3:0: /usr/include/mysql/mysql.h:442:14: note: expected ‘struct MYSQL *’ but argument is of type ‘char *’ int STDCALL mysql_query(MYSQL *mysql, const char *q); ^ powerlog2.c:17:2: error: too few arguments to function ‘mysql_query’ mysql_query(sql); ^ In file included from powerlog2.c:3:0: /usr/include/mysql/mysql.h:442:14: note: declared here int STDCALL mysql_query(MYSQL *mysql, const char *q); ^ powerlog2.c:18:2: error: too few arguments to function ‘mysql_close’ mysql_close(); ^ In file included from powerlog2.c:3:0: /usr/include/mysql/mysql.h:846:14: note: declared here void STDCALL mysql_close(MYSQL *sock); ^ make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql /tmp/ccmaofcA.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -lmysqlclient /usr/bin/ld: cannot find -lmysqlclient collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql /tmp/ccBSwNsn.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L /usr/lib/mysql/libmysqlclient.a -lz -L/usr/lib/mysql -lmysqlclient#-I/usr/include/mysql powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -lz /usr/bin/ld: cannot find -lmysqlclient collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib/mysql -lz /tmp/cc2Im4ua.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql /tmp/ccL557U7.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ mak bash: mak: command not found... [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L /usr/local/mysql/lib/*.a -lz /tmp/ccY9nk5w.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ sudo yum install mysql-client [sudo] password for octopus: Sorry, try again. [sudo] password for octopus: Loaded plugins: langpacks, refresh-packagekit No package mysql-client available. Error: Nothing to do [octopus@pc3 powerlog]$ sudo yum install libmysql++ Loaded plugins: langpacks, refresh-packagekit No package libmysql++ available. Error: Nothing to do [octopus@pc3 powerlog]$ sudo yum install libmysql Loaded plugins: langpacks, refresh-packagekit No package libmysql available. Error: Nothing to do [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I /usr/include/mysql -l mysqlclient /usr/bin/ld: cannot find -lmysqlclient collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I /usr/include/mysql -l mysqlclient /usr/bin/ld: cannot find -lmysqlclient collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ mysql_config --libs -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I /usr/include/mysql -l mysqlclient /usr/bin/ld: cannot find -lmysqlclient collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ mysql_config -cflags Usage: /usr/bin/mysql_config [OPTIONS] Options: --cflags [-I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1] --include [-I/usr/include/mysql] --libs [-L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl] --libs_r [-L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl] --plugindir [/usr/lib64/mysql/plugin] --socket [/var/lib/mysql/mysql.sock] --port [0] --version [5.5.31] --libmysqld-libs [-L/usr/lib64/mysql -lmysqld] --variable=VAR VAR is one of: pkgincludedir [/usr/include/mysql] pkglibdir [/usr/lib64/mysql] plugindir [/usr/lib64/mysql/plugin] [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 In file included from /usr/include/stdio.h:27:0, from powerlog2.c:2: /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ /tmp/ccXjuFfv.o: In function `main': /home/octopus/Programs/powerlog/powerlog2.c:8: undefined reference to `mysql_init' /home/octopus/Programs/powerlog/powerlog2.c:9: undefined reference to `mysql_real_connect' /home/octopus/Programs/powerlog/powerlog2.c:15: undefined reference to `mysql_query' /home/octopus/Programs/powerlog/powerlog2.c:18: undefined reference to `mysql_query' /home/octopus/Programs/powerlog/powerlog2.c:19: undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc -o powerlog2 powerlog2.c powerlog2.c:3:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ mysql_config --libs -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl [octopus@pc3 powerlog]$ mysql_config --cflags -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 powerlog2.c -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl In file included from /usr/include/stdio.h:27:0, from powerlog2.c:2: /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ [octopus@pc3 powerlog]$ ls autorun.sh Makefile oldversion powerlog2 powerlog2.c [octopus@pc3 powerlog]$ ./powerlog2 [octopus@pc3 powerlog]$ make make: `powerlog2' is up to date. [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl In file included from /usr/include/stdio.h:27:0, from powerlog2.c:2: /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ [octopus@pc3 powerlog]$ ./powerlog2 Welcome [octopus@pc3 powerlog]$ make make: `powerlog2' is up to date. [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl gcc: error: unrecognized command line option ‘-Wp’ make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl #gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto #gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl [octopus@pc3 powerlog]$ make #gcc powerlog2.c -o powerlog2 #-I /usr/include/mysql -l mysqlclient gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto #gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl [octopus@pc3 powerlog]$ clear [3;J [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lcrypto [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lz -lm [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lz [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient [octopus@pc3 powerlog]$ make gcc powerlog2.c -o powerlog2 -I/usr/include/mysql -L/usr/lib64/mysql /tmp/ccRsGTYv.o: In function `main': powerlog2.c:(.text+0x16): undefined reference to `mysql_init' powerlog2.c:(.text+0x51): undefined reference to `mysql_real_connect' powerlog2.c:(.text+0x7e): undefined reference to `mysql_query' powerlog2.c:(.text+0xfd): undefined reference to `mysql_query' powerlog2.c:(.text+0x10c): undefined reference to `mysql_close' collect2: error: ld returned 1 exit status make: *** [powerlog2] Error 1 [octopus@pc3 powerlog]$
|