Solved

Compiling and #include not seeming to have an effect

Posted on 1998-07-22
5
217 Views
Last Modified: 2013-11-18
I have a class called Human it is defined in Human.h and implemented in Human.cpp.  Now Have another class called LoosenCommand.  In LoosenCommand.h I have a #include "Human.h"  then the constructor for LoosenCommand takes a Human*.  When I do  CC on LoosenCommand I get Human is undefined?  Why is this?  I seemed to have fixed it using class Human; declaration at the top.  It now compiles but as soon as the refrence to a Human is hit in LoosenCommand it crashes, so that leads me to beleive that I have just told the compiler Human will be declared later, but LoosenCommand never finds it.  So how do I do this?  
0
Comment
Question by:micah
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1168386
can you post your code?

if it is too long you could e-mail it to me (all files) at  nietod@theshop.net.
0
 
LVL 5

Accepted Solution

by:
jstegall earned 50 total points
ID: 1168387
Try using the full path to Human.h in the #include statement in
LoosenCommand.h.  You can use a make file where all dependecies
are expressed.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1168388
if the compiler does not find the intclude file it will probably produce an error saying so.  In any case, it will not compile so that is not likely to be the cause.  
0
 
LVL 2

Expert Comment

by:warmcat
ID: 1168389
Yes, agree with nietod; the makefile wouldn't help anyhow jstegall; and micah, when you say ''it crashes'', what exactly does it do?  You mean ''I get a compiler error''?
0
 
LVL 3

Expert Comment

by:LucHoltkamp
ID: 1168390
Or a linker error perhaps?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

895 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

19 Experts available now in Live!

Get 1:1 Help Now