Solved

Compiling and #include not seeming to have an effect

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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…
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…
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…

776 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