First Pass At Compiling

These are my notes for our first pass at compiling for linux/unix/Mac. For macs, you will need to install Xcode . You will also wants to install emacs . For unix or linux, make certain you install gcc and emacs. Check your distribution for more information.

Create the Text file.

  1. At the command prompt type "emacs filname".   emacs is perhaps the standard text editor for unix/linux.
  2. Type your C program. 
  3. Type ctrl-X,S to save the file. Type ctrl-X,C to quit.

Compile the Text file

We will assume that you called the file bob.c

  1. gcc bob.c
  2. Notice that you now have a file called a.out.   This is your executabke
  3. You can change the name of your executable file with the -o option.
    gcc -o test test.c

Execute the program

  1. Type either a.out or ./a.out