Database Reference
In-Depth Information
Compiling with C Includes
You can useany compiler to compile the program we wrote, but I'll show the GNU C
Compiler (
gcc
) herebecause it's free software and automatically loaded on some systems.
To compile and link the program, enter something like the following from the command
line:
gcc -c `mysql_config --cflags`
mysql_c_prog.c
gcc -o
mysql_c_prog mysql_c_prog.o
`mysql_config --libs`
When the compiler attempts to compile the program (
mysql_c_prog.c
), it will check for
syntax errors in the code. If it finds any, it will fail to compile and will display error mes-
sages. If it's successful, the resulting compiled program (
mysql_c_prog
) will be ready to
beexecuted.