Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The code in project2 is for a program that plays a simple game called Chomp. The

ID: 3916729 • Letter: T

Question

The code in project2 is for a program that plays a simple game called Chomp. The programmers of this project have opted to package some of their code in a “module” called chomp.adt, from which the related files cookie.h and cookie.cpp files can be generated. The steps necessary to produce this program are: Run the command csplit chomp.adt "/Split Here/" and copy the resulting file xx00 to cookie.h. Run the command csplit chomp.adt "/Split Here/" and copy the resulting file xx01 to cookie.cpp. Compile cookie.cpp to produce cookie.o. Compile mainProg.cpp to produce mainProg.o. Link the the .o files to produce an executable program named chomp Write a makefile that will carry out these steps. Your makefile should result in only the minimum required amount of steps when any input file to this process is changed. (Note: you will probably not be able to base this makefile upon my self-updating makefile as in the earlier part of the assignment. Instead, you will probably find it necessary to write this one from scratch.

I have no idea where I went wrong and why it doesn't work...still in the learning process..any help will be greatly appreciated

all: playChomp

playChomp: cookie.o mainProg.o
g++ -g -DDEBUG cookie.o mainProg.o
mv a.out playChomp
cookie.o: cookie.cpp cookie.h
g++ -g -DDEBUG -c cookie.cpp
mainProg.o: mainProg.cpp cookie.h
g++ -g -DDEBUG -c mainProg.cpp

Explanation / Answer

CC=g++

CFLAGS=-I.

DEPS = cookie.h

OBJ = cookie.o mainProg.o

%.o: %.cpp $(DEPS)

        $(CC) -c -o $@ $< $(CFLAGS)

playChomp: $(OBJ)

        g++ -o $@ $^ $(CFLAGS)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote