|
-
July 21st, 2009, 02:24 PM
#1
Code can't find previously defined class
I have a file that has several class delcarations in it. It looks like
Code:
class A : public B
{
public:
virtual int call (void)
{
stuff;
return -1;
}
};
class C : public D, private E
{
stuff;
};
int C::foo(void)
{
A *req;
return 0;
}
When I try to compile, at "A *req" I get identifier "req" is undefined. But req isn't the identifier, A is. So it looks like it can't find A. But why wouldn't it find it. It's in the same file.
Last edited by homer_3; July 21st, 2009 at 02:59 PM.
-
July 21st, 2009, 02:38 PM
#2
Re: Code can't find previously defined class
Did you forget to put the semicolon on the end of class C?
-
July 21st, 2009, 03:00 PM
#3
Re: Code can't find previously defined class
No, sorry. That was just a typo. I fixed it in the edit.
-
July 22nd, 2009, 05:59 AM
#4
Re: Code can't find previously defined class
Post the smallest and simplest program that demonstrates the error. Also, post the exact error message.
-
July 22nd, 2009, 08:59 AM
#5
Re: Code can't find previously defined class
Where are D and E? Is this all one file, or did you forget to include something.. or have circular references. Circular references are the hardest to find.
-
July 22nd, 2009, 10:19 AM
#6
Re: Code can't find previously defined class
I've given up on this error. I was getting it while compiling ACE. From everything I see, it should be compiling fine. But the error was coming from an examples folder, so it's not core code. So I just commented out the refernce to the makefile that compiles the file giving the error and continued on. The only thing I can think of is it is an issue with my compiler.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|