cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : General C++ Programming : Inheritance compile error
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Articles
Lounge
Jobs

-

post  Inheritance compile error

bschmitt78 (3)
Hello,

Being relatively new to OOP, inheritance is the topic at hand in my class presently. I wrote a 3 mini-programs that each inherit from a base class called "Employee." The compile error I am getting is as follows, and I am wondering if it's due to the Employee.h header file not being located in the same local directory as my derived class:

fatal error C1083: Cannot open include file: 'Employee.h': No such file or directory
1>Generating Code...

I used the #include "Employee.h" specifier in my derived classes, and I used the resolution operators correctly:

public class CommissionEmployee : public Employee

If you need to see all my program code, I can post it, but I don't think the code I have would help figure this out because the base class is not being recognized at all. I am using Visual C++ Express 2005, and I know that under tools-options there is a screen to configure your library, source, etc., directories but I think all those settings are fine.

Thanks!!
|
firedraco (338)
You probably need to move Employee.h to the same directory as the other projects you are including it into.
|
Zhuge (56)
Yes. Putting quotes around the file you are including tells the compiler to look in the same directory for the file.
|
bschmitt78 (3)
OK, thanks. I will try moving the base class files to the derived class directory.
|
bschmitt78 (3)
You guys ROCK, thanks! This worked.
|

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us