>MFC.obj : error LNK2001: unresolved external symbol "class CWinApp theApp" (?theApp@@3VCWinApp@@A)
1>F:\test\itk_test\bin\Project1\MFC\Debug\MFC.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://f:\test\itk_test\bin\Project1\MFC\MFC\Debug\BuildLog.htm"

解决方案 »

  1.   

    主要问题是我自己写的.h文件在include到.cpp文件中时说没这个.h文件
      

  2.   

    在出错的文件中加入:extern CxxxxApp theApp;
      

  3.   

    要添加到工程中啊,
    或者
    #include "./XX.h"
      

  4.   

    因为 theApp 变量是写在 XXX.cpp 文件中的,MFC的工程会自动生成.
    这个变量并没有在 h 文件中声明,其他的CPP文件要用该变量.
    就要加上 extern CWinApp theApp;
    这样告诉编译器,该变量在其他源文件中,就行了.