IntPointwhich is identical to Horstmann's Point class as defined on Page 657, with two exceptions:
IntPointhas integer coordinates.
IntPointwon't be able to draw itself on
You should have a header file with declarations in
IntPoint.h and definitions in
You may wish to refer to the files in
~mc38/labs/point/clock/, which contains the
Clock game from the book split among different files.
g++ -g -Wall -Werror -c -o IntPoint.o IntPoint.ccYou should use the following variables:
CXX = g++ CC = $(CXX) CPPFLAGS = LDFLAGS = CXXFLAGS = -g -Wall -WerrorThere is one new option "-Werror" which says, don't let me run my program if there are any warnings.
clean: rm -f *~ \#* *.o MY_PROGRAM_NAMEThis says, ``If I type
make cleanremove all of the
emacsbackup files (prog.cc~ and #prog.cc#), remove all the object files (prog.o), and remove my executable program (
main()and calls your point class. Your
mainwill just create a point, move it, and then output its final coordinates. Don't forget to start this file with the appropriate
You'll need to update your Makefile to include the following additional compilation commands:
g++ -g -Wall -Werror -c -o main.o main.cc g++ main.o IntPoint.o -o mainThe first turns your
main.o. The second turns your two
.o's into an executable
mainwhich you can run.
main.ccin your Makefile so that first
main.ois generated, and then
IntPoint.oare linked together.
make cleanto clean up your directory. Type
lsto see if only critical files remain. Then, remove your two
Makefileactions which create
IntPoint.o. (The actions are the actual commands
makeexecutes to compile your code. Don't remove the dependency lists.) Surprisingly, the program should still compile when you type
Makefilein one buffer and the
*compilation*buffer in the other. We'll also look at your