Solved

Make screwing up on #include?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

821 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