These guidelines on getting help are provided courtesy of Prof. Hybinette. They are several years old, but still true and to the point. Just replace "maria" with your own login id, g++ with gcc if applying to a C program, and ajax with odin. -- RWR 6/8/09 ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Dear class, When asking for help and assistance several of you do not give enough details of your problem. This takes time away from helping other fellow students, the TA, and the instructor. Here are some guidelines that will improve your chances to get a speedy reply. Please follow these guidelines when sending email or coming for office-visits. (1) Come prepared. (2) Make sure that you give a detailed and descriptive report of your problem. (a) Details "may" include: output of your interaction with your program. Example Interaction: {ajax:maria:25} make clean rm -f core *.o a.out Driver {ajax:maria:26} make Driver g++ -g -c -o Driver.o Driver.cpp g++ -g -c -o Coordinate.o Coordinate.cpp g++ -g -c -o Rectangle.o Rectangle.cpp g++ -g -o Driver Driver.o Coordinate.o Rectangle.o -ansi {ajax:maria:27} Driver (3) filter down the problem (this is also an excellent method to debug code). (a) filter down the "code" to a compilable module (or un-compilable module -- if that is your specific problem) that illustrates your problem. --> REMOVE all extraneous code. (b) bring or submit the "module" in a small .cpp file that includes a Makefile Other HINTS in finding BUGS in programs: (1) Always use the debug flag "-g" flag when compiling code. See Example interaction in guideline "2" that uses the debug flag. (2) Use the debugger "gdb" to hunt down bugs in your code. For more details on gdb see links available from the "resources" sub-page of the course main page. ------------------------------------------------------------------------------ Examples of un-sufficient information: Example 1: > My program doesnt work and I followed the instructions given > in class. Here is my program. Example 2: > I have a driver.cpp, Rectangle2.cpp, Point.cpp, Rectangle2.h, and > Point.h. The driver file runs the program. > > There are .o files from my .cpp files but I can't get the program > to run. I tried to follow what you said in Re: Makefile help but > neither > way worked. > > Please help, > It is impossible for me to tell you your problem from the above descriptions. For example 2, it may be that (1) you dont have an executable in your directory, e.g. the files did not link. (2) you may have an executable, but your path variable is not looking in your "current" directory (you need to add a "./" prefix to your run command (see (6) below). appropriate details for example 2 are listed below: (1) give me a listing of the files of the directory on ajax where you are developing your program. For example: {ajax:maria:3} ls -l total 64 -rw-r--r-- 1 maria maria 918 Feb 10 09:42 Coordinate.cpp -rw-r--r-- 1 maria maria 1253 Feb 10 09:41 Coordinate.h -rw-r--r-- 1 maria maria 1524 Feb 17 10:22 Coordinate.o -rwxr-xr-x 1 maria maria 19949 Feb 17 10:22 Driver* -rw-r--r-- 1 maria maria 410 Feb 10 09:46 Makefile (2) tell me the output of the below command: Example: {ajax:maria:241} which g++ /opt/sfw/bin//g++ (3) give me the content of your makefile (that includes tabs and end of line characters): For example: {ajax:maria:263} cat -vet Makefile CC = g++$ CFLAGS = -g$ $ all : Driver$ $ RSRC = ^IDriver.c \$ ^ICoordinate.c \$ ^IRectangle.c$ $ ROBJS = $(RSRC:%.c=%.o)$ $ clean :$ ^Irm -f core *.o a.out Driver $ $ Driver : $(ROBJS)$ ^I$(CC) $(CFLAGS) -o Driver $(ROBJS) -ansi $ $ %.o : %.cpp$ ^I$(CC) $(CFLAGS) -c $< -o $@ -ansi$ (4) give me the ouput of the make command: For example: {ajax:maria:243} make clean rm -f core *.o a.out Driver {ajax:maria:244} make Driver g++ -g -c Driver.cpp -o Driver.o -ansi g++ -g -c Coordinate.cpp -o Coordinate.o -ansi g++ -g -c Rectangle.cpp -o Rectangle.o -ansi g++ -g -o Driver Driver.o Coordinate.o Rectangle.o -ansi {ajax:maria:245} (5) after compiling, give me a listing of your program (see example question (1)). (6) if there is a listing of "an executable", i.e. a file that ends with a star, as in the above: -rwxr-xr-x 1 maria maria 19949 Feb 17 10:22 Driver* tell me the output when you run your executable with the "./" as a prefix, For example running the Executable "Driver" as: ./Driver ------------------------------------------------------------------------------