--------------------Configuration: Te2 - Win32 Debug--------------------
Compiling...
Te2Dlg.cpp
e:\projecttesting\te2\te2dlg.cpp(4) : warning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
E:\ProjectTesting\Te2\Te2Dlg.cpp(189) : error C2039: 'theApp' : is not a member of '`global namespace''
E:\ProjectTesting\Te2\Te2Dlg.cpp(189) : error C2065: 'theApp' : undeclared identifier
E:\ProjectTesting\Te2\Te2Dlg.cpp(189) : error C2228: left of '.session' must have class/struct/union type
E:\ProjectTesting\Te2\Te2Dlg.cpp(189) : error C2228: left of '.GetFtpConnection' must have class/struct/union type
Error executing cl.exe.
在工程Te2想在class Te2Dlg的方法里引用全局对象theApp,已经添加头文件#include "Te2.h",怎么还是会出现以上的编译错误?到底是哪里出了毛病?

解决方案 »

  1.   

    还真没直接用过theApp,用AfxGetApp可以得到。
      

  2.   

    先要声明下 extern ... theApp,不要直接拿来用,这样说名theApp是在其它地方定义的,要不你就用AfxGetApp
      

  3.   

    谢谢!但是我用AfxGetApp()可以通过编译,但是运行程序的时候出现Assertion Debug Failed !这样的断言提示,根据提示查找到的断言代码:ASSERT
    (afxCurrentAppName!=NULL);return afxCurrentAppName;我想知道这是怎么回事,难道我用全局对象theApp会改变目前App的名字么?
      

  4.   

    谢谢!但是我用AfxGetApp()可以通过编译,但是运行程序的时候出现Assertion Debug Failed !这样的断言提示,根据提示查找到的断言代码:ASSERT(afxCurrentAppName!=NULL); return afxCurrentAppName;我想知道这是怎么回事,难道我用全局对象theApp会改变目前App的名字么?