Makefile Newbie: Inheritance Question

This is a discussion on Makefile Newbie: Inheritance Question within the C++ Programming forums, part of the General Programming Boards category; I'm a bit new to makefiles, so pardon me if this question is really foolish. If I have a single ...

  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, 08:50 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 09:00 AM
  3. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 07:46 AM
  4. makefile question
    By hka26 in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2007, 01:01 AM
  5. makefile question
    By spank in forum Tech Board
    Replies: 3
    Last Post: 07-23-2007, 11:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21