C++ .NET 2.0 を使用しています
私は2つのフォームを持っています
最初のものは次のように宣言されています
#include "stdafx.h"
namespace myNamespace{
public ref class frmMain : public System::Windows::Forms::Form {
/*... snip ...*/
public void addNewRow(String^ text){ /*... snip... */ }
public void launchSubForm() { SubForm^ sf = gcnew SubForm(this); sf->Show(); }
};
}
2つ目はこうなる
#include stdafx.h
namespace myNamespace{
ref class frmMain;
public ref class SubForm : public System::Windows::Forms::Form {
frmMain^ myMain;
SubForm ( frmMain^ pMain){
myMain = pMain;
}
/*... snip ...*/
public void exportRows(String^ text){ /*... snip... */ }
myMain->addNewRow("myNewText"); <--- This line causes compile error
};
}
stdafx.hi には
/*... snip... */
#include "SubForm.h"
#include "frmMain.h"
では質問へ!SubForm の行により、コンパイラは「未定義の型 myNamespace::frmMain の使用」を通知します
「ref class frmMain」がこの問題を解決しない理由について、私は本当に手がかりがありません