こんにちは、私はVisual C ++を初めて使用しますが、C++は使用しません。フォームを表示/非表示にする方法を理解しようとして問題が発生しています。
フォームForm1と別のフォームTestFormがあるとしましょう。Form1.hのボタンクリック機能に次のコードがあります。
Form1::Hide();
TestForm^ form = gcnew TestForm();
form->Show();
そしてそれはうまくいきます。ボタンをクリックすると、Form1が消え、TestFormが表示されます。しかし、TestForm.hで同じことを行うと(表示/非表示に設定されているフォームを変更するだけ)、Form1.h(以前は機能していた)とTestForm.hの両方で多数のコンパイラエラーが発生します。
Form1.cpp
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2065: 'Form1' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2061: syntax error : identifier 'Form1'
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(87): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(87): error C2227: left of '->Show' must point to class/struct/union/generic type
type is ''unknown-type''
TestForm.cpp
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2065: 'TestForm' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2061: syntax error : identifier 'TestForm'
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(104): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(104): error C2227: left of '->Show' must point to class/struct/union/generic type
type is ''unknown-type''