Note: These instructions assume you are logged on to Linux on a Computer Science Lab computer. The same commands will work if you are remotely connected to a Computer Science computer via a terminal window (see Computer Science wiki for how to do so) AND on your own computer if have correctly installed gcc (the compiler).
A little background...The compiler we are using this quarter is called gcc. We will be using specific compiler options (or flags) to control the behavior of the compiler. Note I will be using these flags when grading all of your programs. Therefore, you must use these same flags to be sure your code will compile for me when I grade it. If you don't, your code may compile and work for you but not for me. If your code does not compile for me you will recieve a grade of zero for the assignment.
The flags may be entered in any order after the compiler (gcc) and before your C-source file(s). Here are some of the flags you may be using along with a brief description of the affect they have on the compiler's behavior:
-ansi: Affects the particular version of the the C-language to use (see ANSI C, a.k.a. C89).If you have more that one source file that makes up your single program you would simply list them all, separated with spaces, in the command above. For example, assumming you have mySource1.c, mySource2.c, and mySource3.c, the command to compile them into a single program would be:
gcc -ansi pedantic -Wall -Werror -lm mySource1.c mySource2.c mySource3.cThis may look odd to you so a little explaination may help. First of all, by default the compiler names the executable a.out, and secondly, your Linux accounts, by default, do not look in the current directory for commands. The './' prepended to the 'a.out' tells the command shell your running in to look in the current directory.
Two ways to name your executable something other than a.out:This will result in the executable produced by the compiler being named myBaby instead of a.out. To run it you would use the following command:
myBaby