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.
- At the command prompt type "emacs filname". emacs is perhaps the standard text editor for unix/linux.
- Type your C program.
- 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
- gcc bob.c
- Notice that you now have a file called a.out. This is your executabke
- You can change the name of your
executable file with the -o option.
gcc -o test test.c
Execute the program
- Type either a.out or ./a.out