Solved

Make screwing up on #include?

Posted on 1998-08-18
2
163 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now