Thread: Makefile Newbie: Inheritance Question

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    37

    Red face Makefile Newbie: Inheritance Question

    I'm a bit new to makefiles, so pardon me if this question is really foolish.

    If I have a single class called Entity, my makefile will be as follows:

    Code:
    CCC = mingw32-g++
    BINARIES = Main.o Container.o Entity.o Object.o Room.o
    
    all : $(BINARIES)
    	${CCC} -o game.exe ${BINARIES}
    
    Main.o : Entity.h
    	$(CCC) -c Main.cpp
    
    Entity.o : Entity.h Entity.cpp
    	$(CCC) -c Entity.cpp
    
    clean : 
    	del /q /s ${BINARIES}
    I'm concerned about the
    Code:
    Entity.o : Entity.h Entity.cpp
    line. If I later make a class called TempEntity, which is a derived class of Entity, how would I need to compile the O file?

    Would it be:
    Code:
    TempEntity.o : TempEntity.h TempEntity.cpp
    or
    Code:
    TempEntity.o : Entity.h Entity.cpp TempEntity.h TempEntity.cpp
    and why?

    --Ashiq

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    37
    Ohhh, wow. That seems so simple now, I can't believe I missed it before. Thanks!

    --Ashiq

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    37
    Sweeeeeeeeeeeet. Thanks...I'll just use that in the future

    --Ashiq

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid newbie question
    By TimL in forum C Programming
    Replies: 13
    Last Post: 07-18-2008, 07:50 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 08:00 AM
  3. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  4. makefile question
    By hka26 in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2007, 12:01 AM
  5. makefile question
    By spank in forum Tech Board
    Replies: 3
    Last Post: 07-23-2007, 10:10 AM