I am migrating a small C++/CLI project from VS2008 to VS2012, and have run into a frustrating issue.
In my MainForm I have two forward declarations of classes. These are in between the namespace declaration, and the MainForm declaration.
These two forward declarations cause the designer to complain with the error “The class MainForm can be designed, but is not the first class in the file. Visual Studo requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.”
Any ideas on potential solutions? I tried putting the references in the class, and after the class and neither had positive results.
Visual Studio just needs to see the
MainFormclass first. The easiest way to do this without adding includes would be to forward declareMainFormitself: