Solved

Compiling and #include not seeming to have an effect

Posted on 1998-07-22
5
224 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Specific format 21 238
How to write an English digest paper 6 142
Make Line Items Look Good Over Mobile 2 126
Need some help with design 17 46
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
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.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

737 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