Run()加一个参数把CMyView送进去void DLIST::Run(CMyView* pView)
{
      
     //cout<<"running"<<endl;
     //如何将cout换为可用到VIEW视图的输出接口
   pView->xxx
}

解决方案 »

  1.   


    谢谢你的帮助。我现在遇到一个文件包含的问题。
    如:
     DLIST::Run(CMyView* pView);定义函数需要包含CMyView的头文件。但是dlist.h又需要被CMyView头文件包含。请问这种情况下如何处理
      

  2.   

    当底层函数如下定义就会出现编译问题:
    #include <stdafx.h>
    #include "dlist.h"
    #if 1
    #include "MFC_LOTTERYView.h"
    void Print(CMFC_LOTTERYView* pview,CString str)
    {
    pview->SetWindowText(str);
    }
    #endif 编译错误为:
    error C2143: 语法错误 : 缺少“;”(在“*”的前面)
    error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
    error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
    warning C4183: “GetDocument”: 缺少返回类型;假定为返回“int”的成员函数如果改为#if 0编译就能正常。
      

  3.   

    #pragma once
    在头文件中第一行加上
      

  4.   

    在dlist.h 加入了#pragma once还是一样的错误。