Q. What compiler do we use?
A. gccx.
Q. What is gccx?
A. The compiler with which your programs must compile is the gnu compiler gcc. However, for gcc to be able to make use of the additional libraries we are using in this course, you need to tell gcc where to look. In order to simplify matters, gccx has been installed. gccx is a script which first tells gcc where to find the libraries for this course, then runs gcc normally. This way you can compile using gccx, which will act exactly like gcc, except that you won't have to tell it where the libraries are.
If you plan to use a machine other than csa, you will have to install the libraries and gccx on that machine, and you must submit programs which run properly on csa. There is information on this on the homepage.
Q. When I type gccx I get a message like 'command not found'. What went wrong?
A.
Not everyone on the system needs to have access to gccx. The easiest way for
you to gain access is to modify the file .cshrc in your home
directory. Rob has put together a script which will do this for you.
Just type
/home/course/cs113/rpruim/F97/section/setup
Now log out and log back in again (or type source .cshrc from your home directory). You should see a message which tells you that the environment for CS113 has been established. This will set some environment variables and aliases so that you have access to everything you need. If changes need to be made, we will edit .cshrc.cs113, and it will be updated everytime you log in.
(For you UNIX experts: gccx and the necessary library files are located in /home/course/cs113/rpruim/cslib. I plan to put other files you need to access in /home/course/cs113/rpruim/F97/include and in /home/course/cs113/rpruim/F97/bin. You can use this information to make the changes to your path yourself if, for example, you prefer a shell other than tcsh.)
Q. How do I use the "Makefile" for HW1?
A. Please make sure that you can compile your HW1 programs using our Makefile. Using netscape, go to the web page that has the description for HW1. Choose the link that goes to the "Makefile". While viewing this Makefile, choose "Save As..." from netscape's "File" menu. It will want to save the file as "Makefile.a1". Click on Ok.
Your must rename the file using the move command, at the UNIX prompt:
mv Makefile.a1 Makefile
Also, you must make sure the Makefile is in the same directory as you program files. If not, you will have to move the Makefile there. For example, if your files are in "hw1", you may need to do:
mv Makefile hw1
At the UNIX prompt, make sure you are in the directory with the Makefile and your source files, type:
make
It should create the files: hw1-factor, hw1-pi, hw1-bank without any errors (if you've correctly written the programs).
Run each of them to make sure they work. If you type
make test
the programs will be run on some test data which I have provided.
If your programs work but this test does not work properly then you probably
have not followed the directions for input and output carefully. Be
sure to the problem fixed before you submit your work.
Don't forget to "submit" your source code when you are done and your programs work (Rob will walk you through an example in discussion).
Q. I don't know what I did, but the makefile wouldn't work when compiling, although separately gccx worked fine. It gave me some kind of error in line 28. Line 28 just says:
tidy:What do you think? did I paste it into emacs wrong or what? I've already submitted the files, and they work fine.
A. You need to use the saving procedure I mentioned above to save the Makefile. Commands in the Makefile that generate files, like: $(CC) $(CFLAGS) -c hw1-pi.c have to begin with the TAB character. When you cut and paste often, TABS get turned into SPACES and thus the Makefile will no longer work. Saving the Makefile via netscape as previously mentioned will keep the TABS as TABS.
Q. I didn't do the Makefile thing and gccx worked just fine and my programs ran just fine. They all compiled to a.out, but they worked fine. Is that OK, I already submitted my programs?
A. Well, the grader will be using the Makefile to check that your program compiles correctly, so you should verify that the Makefile works with your program.