There is a form Form1.h, in which there is the following description:

public ref class Form1 : public System::Windows::Forms::Form { ... }; 

How to describe a pointer to this form in another form or module?

Form1^ MainForm; - does not work, writes an error:

error C2061: БинтаксичСская ошибка: ΠΈΠ΄Π΅Π½Ρ‚ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€ "Form1".

  • @ Sergey041691, To format a code, select it with the mouse and click on the button 101010 of the editor. - Nicolas Chabanovsky ♦
  • @ Sergey041691 what compiler? is it a studio Put the project on a file sharing service, right now, have experimented - everything works - BogolyubskiyAlexey
  • Maybe after all Form ^ MainForm without one? - PaulD
  • Surely you just forgot the namespace. Or maybe ordering a field in the wrong place. - VladD
  • @ HashCode, I do not have one button "101010"? Instead of it {}? - teanYCH

1 answer 1

I can be wrong, but plug in the module where you want to use the Form1.h file

 #include "Form1.h" 
  • Unfortunately, it does not help, it was written that way. - Sergey041691