CSci 230: Computing Systems Organization
Home Syllabus Readings Assignments Tests

Compiling C programs

You can write C programs using either the command line or Eclipse. I recommend using Eclipse.

Via the command line

  1. Edit and save the file(s) with a text editor such as gedit, jEdit, emacs, or vi.

  2. At the terminal window, navigate into the directory in which the file(s) are saved. You can do this using the cd command, as in cd directoryName.

  3. Compile the file(s) using the gcc command as in gcc -Wall fileNames.

  4. If compilation was successful, then you can execute the program by executing the a.out file created by gcc: type ./a.out.

Via Eclipse

Eclipse is a powerful program written for developing programs of all types. It was originally developed for writing Java programs, but it handles C (and C++) nicely if you include a very nice standard extension called CDT. Both Eclipse and CDT are already installed on the Linux laboratory computers, but if you want to install it on your own computer, I can suggest the following.

In the following, I'll assume you already have CDT installed.