Some comments on the programming environment used in class
Use Notepad for creating the C programs. Save the program to the computer and remember where you saved it. For instance C:\Documents and Settings\Lab. Remember to name your C program file correctly. C program files always have a .c extension, for instance hello.c. Do not save it as a text file, as in hello.c.txt.
Open up a terminal window (command prompt) and navigate to the directory where you saved the C program. Typically, you do this with the cd (change directory) command. For the curious, or for those who need a reference, here is a document that lists DOS commands.
Confirm that you are in the correct directory by typing in dir to generate a listing of the files in the directory. Your C file should be listed.
Compile your program by invoking the cygwin compiler. If cygwin is installed in c:\cygwin\, then c:\cygwin\bin\gcc-3 hello.c -o hello invokes the gcc compiler and causes it to compile the C program in the file hello.c. The resulting executable is written to the file hello.exe. Note:If the PATH variable on your computer includes the c:\cygwin\bin folder, you can compile your program using gcc-3 hello.c -o hello
If compilation produces error messages, read them very carefully. Error messages look like this:
latlong.c: In function ?main?:
latlong.c:13: error: expected ?,? or ?;? before ?printf?
Inspect the lines in your program near the line flagged by the compiler to find your error and fix it. Save the program.
Recompile and repeat the previous step till compilation is error free.