Link to home
Start Free TrialLog in
Avatar of travishaberman
travishaberman

asked on

Help with a simple make file.

Hello experts.  I need to create a simple make file for these files.


main.cpp
BTree.h
BTree.cpp
TreeNode.h
TreeNode.cpp

My instructor gave us this template for the file but I am having trouble understanding it.  Could you please help me fill in the gaps?  Also are there any lines I need to add to main for the file to work properly?

Thank you Experts,

-TH

===========================================================

#compiler command
C++ = g++

# compiler flags
#-g for gdb
#-Wall to check errors and warnings
C++ FLAGS = -c -Wall

#linker command
LINKER = g++

#linker flags
LINKER-FLAGS = -o

# object files and main target

OBJS =                                                                                                   <--------- What goes here?
TARGET =                                                                                               <--------- What goes here?

$(TARGET)= $(OBJS)
      $(LINKER) $(LINKER-FLAGS) $(TARGET) $(OBJS)

clean:
      rm *.o
ASKER CERTIFIED SOLUTION
Avatar of brettmjohnson
brettmjohnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of travishaberman
travishaberman

ASKER

I have just exactly what you show there but I get this error

Makefile:24: *** commands commence before first target.  Stop.

Below is exactly what I have.  What does this error mean?



#compiler command
C++ = g++

# compiler flags
# g- for gdb
# -Wall to check errors and warnings
C++ FLAGS = -c -Wall


#linker command
LINKER = g++

#linker flags
LINKER-FLAGS = -o

# object files and main target
OBJS = main.o BTree.o TreeNode.o
TARGET = main

$(TARGET) = $(OBJS)
        $(LINKER-FLAGS) $(TARGET) $(OBJS)

clean:
        rm *.o




OOOps.. Didn't see your typo comment.. Let me try and fix that...

-TH
I have to take a break for a few so I will get back to you..

Thank you,

-TH
Tried again today and it worked great .. Thanks..

-TH