Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Make screwing up on #include?

Posted on 1998-08-18
2
Medium Priority
?
185 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 300 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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…
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).

722 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