我使用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(); }
};
}
第二个是这样
#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
};
}
in stdafx.hi have
/*... snip... */
#include "SubForm.h"
#include "frmMain.h"
现在来回答这个问题! 在窗体上线使编译器告诉我“使用未定义类型myNameSpace对象的:: frmMain
我真的没有为什么线索‘引用类frmMain’犯规解决这个问题
好吧 我现在真的很笨,但谢谢! =) – Eric 2008-12-17 23:11:49