This document contains:
invalid white space character in directive.
warning: return type of `main' is not `int'
Note that you should first read over the update to lab01 for some corrections (the update document provides some corrections to errors/typos in the original assignment; this document offers hints to help you find the solutions, not corrections to the lab.)
The first is a personal web page, which have any content you like (I gave
you some sample content in the lab01 assignment, in case you are not feeling
especially creative, and/or don't know HTML.) This web page is accessed with
the URL http://udel.edu/~jsample (assume
for the remainder of these instructions that your userid is jsample)
and the file you access to create it is ~/public_html/index.html
http://udel.edu/~jsample/cisc105 and needs to have
some specific content on it. Specifically, it should have a link to the web
page of the "next student in the
web ring".Make sure that after you add both of these web page, and after you do, do the "chmod" command listed above to make your pages accessible.
This hint is for students who basically understand what to do for the lab01b.c part of lab01, and just need help with the "illegal whitespace" error. If you are totally confused by this part of the lab, though, read item (3), "Extra help for lab01b.c" first.
If you have removed all of the other errors in the program, and you get either of the following, here are hints as to how to fix them. The fixes to these errors are not in your textbook.
> cc lab01b.c |
The fix to this error is to go into emacs, find the line of your program that
says:
#include <stdio.h>^M
and get
rid of the ^M character at the end of the line. The ^M character sometimes shows up at the end of every line when files are transferred from DOS or Windows to Unix. Because this program came originally on the floppy disk that is bundled with your textbook, the ^M characters may be there (I later got rid of them in the file once I realized they were causing problems, but if you copied the file from my directory before I did this, you got stuck with the ^M characters.) Normally, these don't cause any problems, however, on the #include statement, with the cc compiler, apparently they do. The ^M characters is the "illegal white space" character that the cc compiler is complaining about; getting rid of it should make the message go away.Next, if you see this message:
> gcc lab01b.c |
The way to get rid of this one is to change the line that says:
void main (void)
to say instead:
int main(void)
The gcc compiler simply expects the main program to return an int, rather than return a void. (I can explain more about this in lecture; if you are curious, ask.) The program will still work with void main(void), but the compiler issues a warning message, which is "messy". Using int main(void) instead cleans things up.
When you compile your lab01b.c program, it is normal to get many syntax errors. For example, here is the sequence of commands that you might initially type to get started on this part of the lab, and the errors that result:
> cd |
If you use gcc instead of cc, you get similar (though different error messages). Comparing the difference between cc and gcc error messages can be one way to help you figure out what is wrong.
> gcc lab01b.c |
It is your job to fix all of these errors by going into emacs, finding the mistakes, and fixing them one at a time. Some hints that may help:
If you already did read it, look over it again, with the lines of your program that the compiler is complaining about "in mind". Trust me, if you do, you'll eventually figure out the problem and you'll know how to fix it.
You may find this process somewhat painstaking and detailed. If so, let me warn you now: this is what programming is often like. If it exceeds your pain threshold too much, you may want to think about whether this is the right course for you or not.
Note that when the last compiler message is gone, you are still NOT NECESSARILY FINISHED! You need to continue applying fixes to the program until the output (when you run ./a.out) matches exactly down to the last character and spacing, the sample output given in the textbook on page 73 (also repeated below). This may require some additional reading in Chapter 2. Watch especially where the line breaks and the periods are.
|