void CMainFrame::OnNew()
{
CString pp; //获得用户在地址栏中输入的URL
m_wndDlgBar.GetDlgItem(IDC_ADDR)->GetWindowText(pp); //浏览指定的网页
((CMyWeb16View*)GetActiveView())->Navigate(pp);
}
出现错误
MainFrm.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\myWeb16\MainFrm.cpp(124) : error C2065: 'CMyWeb16View' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\myWeb16\MainFrm.cpp(124) : error C2059: syntax error : ')'
错误在那里啊?
{
CString pp; //获得用户在地址栏中输入的URL
m_wndDlgBar.GetDlgItem(IDC_ADDR)->GetWindowText(pp); //浏览指定的网页
((CMyWeb16View*)GetActiveView())->Navigate(pp);
}
出现错误
MainFrm.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\myWeb16\MainFrm.cpp(124) : error C2065: 'CMyWeb16View' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\myWeb16\MainFrm.cpp(124) : error C2059: syntax error : ')'
错误在那里啊?
#include"MyWeb16View.h"
c:\program files\microsoft visual studio\myprojects\myweb16\myweb16view.h(21) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio\myprojects\myweb16\myweb16view.h(21) : error C2501: 'CMyWeb16Doc' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\myprojects\myweb16\myweb16view.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\myWeb16\MainFrm.cpp(126) : error C2143: syntax error : missing ';' before '}'
执行 cl.exe 时出错.
CMyWeb16Doc* GetDocument();// Operations提示这里有问题
A.h中#include "B.h"class A
{ B* b;
}B.h中#include "A.h"class B
{
A* a;
}这样就会有错误。需要将B中改成如下所示:
B.h中
class A;class B
{
A* a;
}B.cpp中
#include "A.h"
#include "MyWeb16Doc.h"
#include "MyWeb16Doc.h"