Next: Running the program Up: CreatingCompiling and Running Your Program Previous: Creating the program


Compile your program with the command c89. The command must be followed by the name of the (C) program you wish to compile. A number of compiler options can be specified also. We will not concern ourselves with these options yet. (See Appendix or online manual help for details.)

So the basic compilation command is:

c89 program.c

where program.c is the name of the file.

If there are obvious errors in your program (such as mistypings, misspelling one of the key words or omitting a semi-colon), the compiler will detect and report them.

There may, of course, still be logical errors that the compiler cannot detect. You may be telling the computer to do the wrong operations.

When the compiler has successfully digested your program, the compiled version, or executable, is left in a file called a.out or if the compiler option -o is used : the file listed after the -o.

It is more convenient to use a -o and filename in the compilation as in

c89 -o program program.c

which puts the compiled program into the file program (or any file you name following the "-o" argument) instead of putting it in the file a.out .

After a successful compilation, execute the (UNIX) command

ls -l

to see that a file a.out exists and has execute permission. Observe its size, and compare it with that of the original program source.
Wed Sep 14 10:06:31 BST 1994