?
Solved

Compiling and #include not seeming to have an effect

Posted on 1998-07-22
5
Medium Priority
?
227 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
[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
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 100 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
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…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

777 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