zoukankan      html  css  js  c++  java
  • error C2065: 'theApp' : undeclared identifier

    解决办法一:
    在你要访问的地方的 .cpp 文件中加入
    extern C***App theApp;

    解决办法二:
    得到指向app的指针
    如 ((C***App *)AfxGetApp())->你的成员变量

    我是在主程序的头文件里添加就可以了:

    // five.h : main header file for the FIVE application
    //

    #if !defined(AFX_FIVE_H__0B197DD2_A92A_4BC8_9B02_88A17EC40DBE__INCLUDED_)
    #define AFX_FIVE_H__0B197DD2_A92A_4BC8_9B02_88A17EC40DBE__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000

    #ifndef __AFXWIN_H__
    #error include 'stdafx.h' before including this file for PCH
    #endif

    #include "resource.h" // main symbols

    /////////////////////////////////////////////////////////////////////////////
    // CFiveApp:
    // See five.cpp for the implementation of this class
    //

    class CFiveApp : public CWinApp
    {
    public:
    CFiveApp();

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CFiveApp)
    public:
    virtual BOOL InitInstance();
    //}}AFX_VIRTUAL

    // Implementation

    //{{AFX_MSG(CFiveApp)
    // NOTE - the ClassWizard will add and remove member functions here.
    // DO NOT EDIT what you see in these blocks of generated code !
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    public:
    CDatabase m_DB;
    };

    extern CFiveApp theApp;
    /////////////////////////////////////////////////////////////////////////////

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_FIVE_H__0B197DD2_A92A_4BC8_9B02_88A17EC40DBE__INCLUDED_)
  • 相关阅读:
    C# 使用IComparer自定义List类的排序方案
    ubuntu的vim模式
    linux系统目录结构与层级命令使用
    GitHub托管项目
    应用TortoiseGit为github账号添加SSH keys
    PHP中利用PHPMailer配合QQ邮箱实现发邮件
    QQ互联 网站应用接入
    dedecms 中变量函数
    WebSocket 协议
    前端组件库
  • 原文地址:https://www.cnblogs.com/xiaocai0923/p/2255593.html
Copyright © 2011-2022 走看看