Hey all!

Homework help again...except this time not in the way you think lol...I finished all my problems and realized there's a problem in my makefile which I need in order to submit

Here's the original make file that our professor gave us

CC		=	gcc 
JVC = javac
SOLARISHOME 	= /usr/dt
RM		= rm -rf 
CFLAGS		= $(NORMCFLAGS)	
JVCFLAGS =
LIBS       = -lsocket -lnsl 
.SUFFIXES : .class .java
.java.class :
	$(JVC) $(JVCFLAGS) $<

PROGS = Q1  Q2 Q3 Q4 


all: $(PROGS)

Q1:  Q1.o
	$(CC) $(CFLAGS) -o Q1 Q1.c $(LIBS)
Q2:  Q2.o
	$(CC) $(CFLAGS) -o Q2 Q2.c $(LIBS)
Q3:  Q3.o
	$(CC) $(CFLAGS) -o Q3 Q3.c $(LIBS)
Q4:  Q4.o
	$(CC) $(CFLAGS) -o Q4 Q4.c $(LIBS)


clean:;
	$(RM) $(PROGS) *.class *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags \
	TAGS make.log MakeOut  "#"*

and here's what I tried to do

CC		=	gcc 
CPP             =       g++
JVC = javac
SOLARISHOME 	= /usr/dt
RM		= rm -rf 
CFLAGS		= $(NORMCFLAGS)	
JVCFLAGS =
LIBS       = -lsocket -lnsl 
.SUFFIXES : .class .java
.java.class :
	$(JVC) $(JVCFLAGS) $<

PROGS = Q1  Q2 Q3 Q4 


all: $(PROGS)

Q1:  Q1.o
	$(CPP) $(CFLAGS) -o Q1 Q1.cpp $(LIBS)
Q2:  Q2.o
	$(CPP) $(CFLAGS) -o Q2 Q2.cpp $(LIBS)
Q3:  Q3.o
	$(CPP) $(CFLAGS) -o Q3 Q3.cpp $(LIBS)
Q4:  Q4.o
	$(CC) $(CFLAGS) -o Q4 Q4.c $(LIBS)


clean:;
	$(RM) $(PROGS) *.class *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags \
	TAGS make.log MakeOut  "#"*

What happened was that my professor created the make file as if all 4 programs were written in C and I wrote the first 3 in C++ so how do I setup those first 3 parts of the make file to work for C++ instead of C?

Thanks!

Namaste,
-Ray-

If I was to guest, I would investigate this line

CFLAGS = $(NORMCFLAGS)

What is NORMCFLAGS and is it compatible with g++?

This article has been dead for over six months. Start a new discussion instead.