Next: Basic Motif programming principles Up: A First MOTIF Program Previous: Header Files

Compiling Motif Programs

To compile a Motif program we have to link in the Motif, Xt and Xlib libraries. To do this use: -lXm -lXt -lX11 from the compiler command line. NOTE: The order of these is important.

Our push.c program is written with ANSI style function calls (in keeping with the C Course we did last term). In order to use K &R style that Motif employs we must also use the -common option of the c89 compiler.

Other Compiler options can be tagged on as usual.

So to compile our push.c program we should do:

c89 push.c -o push -common -lXm -lXt -lX11
Tue May 24 16:52:56 BST 1994