I have a project that contains two forms, Form1.h and Form2.h.
The .cpp files of each is test.cpp and Form2.cpp.
I want to open the second form from the first through a button click, of which I already have the code for, placed inside the button1_Click method:
Form2 ^ form = gcnew Form2;
form->Show();
I have furthermore placed the include file in Form1.h (#include “Form2.h”), however I keep getting the following errors:
error C2065: 'Form2' : undeclared identifier
error C2065: 'form' : undeclared identifier
error C2061: syntax error : identifier 'Form2'
error C2065: 'form' : undeclared identifier
error C2227: left of '->Show' must point to class/struct/union/generic type
1> type is ''unknown-type''
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have been searching a solution for a couple of days… none of which worked.
Any help would be appreciated.
Have you included Form1.h in test.cpp?