16,473
社区成员
发帖
与我相关
我的任务
分享
#pragma once
#include "..."
//... //一些声明
#include "Update.h"
class CTestLocalPlayerDlg
{
public :
void app();
//一些函数
};
#pragma once
#include "..."
//一些声明
class CTestLocalPlayerDlg;//前向引用声明
class CUpdate
{
public:
void hello();
};
#include "stdafx.h"
#include "Update.h"
#include "TestLocalPlayer.h"
//问题来了!!!!!!!!!!!!!!!!!!
void CUpdate::hello()
{
//编译的时候 , 如果没有下面注释掉的那句(pWnd->app() ),这个程序可以编译
//这里单步调试显示pWnd获取到的值没有错误
CTestLocalPlayerDlg* pWnd = (CTestLocalPlayerDlg* )AfxGetApp()->GetMainWnd();
//当我加上pWnd->app(),提示错误,错误如下
/*
error C2027: 使用了未定义类型“CTestLocalPlayerDlg”
参见“CTestLocalPlayerDlg”的声明
error C2227: “->app()”的左边必须指向类/结构/联合/泛型类型
*/
//pWnd->app();
//诡异了 这是为什么? 怎么调??pWnd我确定已经成功转换了,因为单步调试的时候我看到了相应的变量
}