Getting Started with gcc, the GNU C compiler

For the EE360N lab assignments, you need to make sure that all your code successfully compiles with the gcc compiler. gcc is an ANSI-C compiler (and linker) that is available free on the UNIX environment. Let's say, for lab assignment 1, you named the file that contains your assembler program assemble.c. To compile this file and produce an executable you need to type the following in the UNIX shell:

If your program does not have any errors, you will notice that the above command produces an executable file named a.out. This is the standard name for the executable created by gcc unless you provide your own preferred name. Now, all you need to do to run your assembler is to type: where inputfile is the name of the file that contains a program written in LC-2 assembly language, and outputfilename is the name of the file that will contain the output of your assembler. If the above doesn't run your program try running it by typing If you would like to call your executable with a different name, you need to use the -o option of gcc. For example, if you want your executable named assemble, you need to compile the source code for your assembler (assemble.c) with the following command: If you would like to learn more about gcc, try the following on the UNIX command prompt: