Link to home
Start Free TrialLog in
Avatar of micah
micah

asked on

Compiling and #include not seeming to have an effect

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?  
Avatar of nietod
nietod

can you post your code?

if it is too long you could e-mail it to me (all files) at  nietod@theshop.net.
ASKER CERTIFIED SOLUTION
Avatar of jstegall
jstegall

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.  
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''?
Or a linker error perhaps?