Re: Inexplicable compiler error (VS '08)
This has been driving me completely bonkers for the past two days now,
and I'm at my wit's end. Let's say I have a class Foo, which is
defined in Foo.h and implemented in Foo.cpp. In another class, I want
to instantiate a Foo object. Pretty simple.
Foo foo; //C2065: 'Foo': undeclared identifier
I'm six-trillion % certain that Foo.h and Foo.cpp are compiled.
That's irrelevant, actually.
fact, if when use the scope or member operator on 'Foo' or 'foo',
Intellinonsense CORRECTLY LISTS ITS ACCESSIBLE MEMBERS!!!! What am I
Take the contents of the Foo.h file and stick them into that source
file, after commenting out the #include, save the file. Drop the 'void'
from between the parentheses. Save the file again. Quit the Visual
Studio app, then reboot your computer. Start Visual Studio again,
reopen the project. Do 'Build | Clean solution'. Then compile this
file again, see if anything is different.
Possible causes: (a) there is a macro you define that hides the entire
definition of 'Foo' from the compiler when you try compiling this file,
(b) Foo is actually defined in a namespace, and you just forgot about
it, (c) You got precompiled headers used and they need to be refreshed,
(d) Your computer is totally wack.
Also, see FAQ 5.8.
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask