I have a program that I am working on. I have run into this problem countless times and it is strange to me that it works sometimes and other times does not.
I have created an application using Visual C++ .NET 2003 standard. Here is an example of the situation.
I add a new form called aboutDialog.
Set the form properties.
In another form I add the #include "aboutDialog.h"
In the code I have the following:
aboutDialog *about = new aboutDialog();
about->ShowDialog();
The compiler is failing to compile and giving a C2061, and C2065 error code. It states that the aboutDialog is undeclared, and that about is undeclared.
I don't understand how it can be undeclared, when I am declaring it. The error occurs on the aboutDialog *about = new aboutDialog(); line of the program.
As I mentioned I have had this problem before. What is even more strange is that in other situations I have gotten this to misteriously work, and then when I try to display another form elsewhere, this first one no longer works. If I remove the second attempt at displaying a form, the first one still will not work.
It has to be possible for many forms in an application to call on and display other forms. For example, dialog boxes. It might be necessary to create dialog boxes for menu items, such as settings, printing preferences, etc. If I cannot get one to work, or multiple ones cause all to fail, how is it possible to have this work
In my experience programming most problems have simple answers, and I am sure that I have overlooked some simple answer to this problem as well.
If it helps I retrieved this example straight from the Microsoft Visual C++ .NET 2003 Step-by-Step book. I also tried a similar example in the O'Reilly Programming .NET Windows Applications book.

Can't Get the Form to appear
jstookey
As I suspected this was a simple, OH how stupid, answer. I failed to properly call the form.
In order for this to work I would have needed to do one of the following two thing(Each of them tested successfully):
1. Call the aboutDialog using the complete class name: namespace::aboutDialog
2. Make the form document that is calling the aboutDialog part of the namespace of the main application form.
Once this has been done the about dialog displays correctly.
Like I said, this was one of those simple solutions that was staring me in the face, but I kept overlooking it.