Solved

Make screwing up on #include?

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

635 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