void CMyVC21View::OnPtpTcp()
{
CTCPdlg dlg;
dlg.DoModal();
}为什么不行?error C2065: 'CTCPdlg' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlg'
error C2065: 'dlg' : undeclared identifier
error C2228: left of '.DoModal' must have class/struct/union type
{
CTCPdlg dlg;
dlg.DoModal();
}为什么不行?error C2065: 'CTCPdlg' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlg'
error C2065: 'dlg' : undeclared identifier
error C2228: left of '.DoModal' must have class/struct/union type
加到里调用
void CMyVC21View::OnPtpTcp()
{
CTCPdlg dlg;
dlg.DoModal();
}
的那个CPP文件的INCLUDE里面。
huang_yu(HY),你好,我是把#include "tcpdlg.h"加在.CPP文件的第二行的,为什么加在上面就不可以呀,我刚才把#include "tcpdlg.h"加在了void CMyVC21View::OnPtpTcp() 前面就可以了,怎么回事呀?:>
#include "MyVC12.h"
#include "MyVC12.h"
#include "tcpdlg.h"先调用的必须放在前面。
打个比方,你想吃鸡蛋的蛋黄(访问"tcpdlg.h"中的元素),肯定要先把蛋白拨开(访问#include "MyVC12.h")。不然是要出错的。。呵呵