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 : ')'
错误在那里啊?

解决方案 »

  1.   

    CMyWeb16View你没有将这个文件包含进来
    #include"MyWeb16View.h"
      

  2.   

    没有包含CMyWeb16View视图所在的头文件
      

  3.   

    郁闷,加上了错误更多MainFrm.cpp
    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 时出错.
      

  4.   

    public:
    CMyWeb16Doc* GetDocument();// Operations提示这里有问题
      

  5.   

    在视类头文件中类定义前加 class CMyWeb16Doc; 做一个声明
      

  6.   

    不是那个地方的问题,还是头文件的东西。你再CMainFrame中包含进这个#include "myweb16view.h"以后,编译的时候打开着这个文件的时候遇见 CMyWeb16Doc* GetDocument(); 不知道是什么东西。所以在CMainFrame再加入#include "MyWeb16Doc.h"让CMainFrame类知道该类的声明!
      

  7.   

    有可能是互相包含的问题。例如:
    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"

      

  8.   

    在这个文件中
    #include "MyWeb16Doc.h"
      

  9.   

    myweb16view.h头上加上
    #include "MyWeb16Doc.h"