Compiling from the Command Line

only for RuBoard - do not distribute or recompile

Compiling from the Command Line

This is the most basic option. It is almost identical to the compile command that was shown in Chapter 6, Order Entry Abstract and Design. Listing 10.1 is the compile command for the WCA. If you download the files from the companion Web site for this book, you will find it in the src directory as a file named build.sh under Chapter 9.

Listing 10.1 Compile Command for WCA
 gcc -Wall -g -o WCA callbacks.c interface.c \               support.c main.c \               comm_utils.c ddc.c \      `gtk-config --cflags --libs` \      -I/usr/include/mysql \      -L/usr/lib/mysql -lmysqlclient -lm -lz 

Recall that:

  • gcc is the compiler being used.

  • -Wall tells the compiler to output all warning messages.

  • -g tells the compiler to compile debugger information into the executable for use with gdb. gdb allows you to step through a compiled program and examine variables as an aid to debugging. It s not absolutely necessary for a clean compile.

  • -o WCA tells the compiler to create an executable named WCA.

  • the various *.c files are the code source files.

  • `gtk-config --cflags --libs` is a program call that in this context acts as a macro because it is called and expands to produce other command line flags for the compiler (and again, don t forget that those are backtick characters , not single quotation marks!).

  • -I and the path tells the compiler to include the mysql files.

  • -L is the path to the library files that need to be included.

  • -l tells the compiler to include the library files that follow; in this case, mysqlclient, m (math), and z (zip).

  • The \ is the line continuation character.

Also remember that:

  • The path variables on your machine might be different.

  • You might or might not need all the library files (m, z , and so on), or you might need others not listed here.

  • In order for this to compile this way, you have to comment out the ...PIXMAP... lines from main.c that Glade inserts . These are normally around line 23 or 24 in main.c .

  • You have to edit main.c to move your form or window widgets up to global level, and you have to include them in the headers for any ?.c files that reference them.

only for RuBoard - do not distribute or recompile


MySQL Building User Interfaces
MySQL: Building User Interfaces (Landmark)
ISBN: 073571049X
EAN: 2147483647
Year: 2001
Pages: 119

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net