Solved

Make screwing up on #include?

Posted on 1998-08-18
2
175 Views
Last Modified: 2013-11-18
Make files have always given me no end of grief.

Any here is a brief rundown on what I have

I have a Device class from which a Tool and Fastener class is derived.  RotationalTool is derived from Tool.  I have various Commands that are derived from Command class.  Then I have a Human class which includes all of the above.  When I do a #include "Human.h" in Device.h I get a whole mess of Device is undefined.  What would cause Device to be undefined simply by including human in Device.h?

"RotationalTool.h", line 19: error(3114): identifier "Device" is undefined
    virtual inline Device* Clone() const { return new RotationalTool(*this); };
                   ^


If you think it would be helpfull I could attach the #includes from each file
Following is the makefile I am using

heracles 874% more Makefile

.SUFFIXES: .o .cpp .c

# to use static ananlyzer in most descript mode uncomment the following
#CC = CC -sa,staticdir
CC = CC
DEBUG = -g -DDEBUG
INCS = -I /usr/deneb/vmap/Axs/include -I /usr/people/mv135329/cppLib    
C++FLAGS = $(DEBUG) -DFUNCPROTO $(INCS) -lmalloc_cv
APPLIB  = ../../lib

.cpp.o:
        $(CC) $(C++FLAGS) -c $*.cpp



OBJECTS= Tool.o\
        Device.o\
        Human.o\
        RotationalTool.o\
        Fastener.o\
        LoosenCommand.o\
        TightenCommand.o\
        ResetCommand.o\
        GrabCommand.o\
        Tag.o


irad.so: $(OBJECTS)
        $(CC) $(DEBUG) -shared -all $(OBJECTS) -o irad.so
        @mv $@ $(APPLIB)

clobber:
        rm -f *.o *~*

0
Comment
Question by:micah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1170655
This has nothing to do with makefiles.  It sounds like it is a problem in the order in which items are declared in the header files and/or the order in which the header files are included.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1170656
In your own words
>> I have a Device class ...Human class which includes all of the above.  
>> When I do a #include "Human.h" in Device.h I get a whole mess of
>> Device is undefined

That would be expected.  The Human.class depends on the device class.  Thus the human.h file needs to include the device.h include file, not the other way around.

Try making human.h include device.h instead.  If that doesn't work, can you post the files.  If the files are too long to post, can you e-mail them to me?  My address is nietod@theshop.net.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question