[英]Simple Display Window program is giving error VS2012
#include<afxwin.h>
#include"stdafx.h"
class CSimpleFrame : public CFrameWnd
{
public:
CSimpleFrame()
{
Create(NULL,L"Windows Application");
}
};
struct CSimpleApp : public CWinApp
{
BOOL InitInstance()
{
CSimpleFrame *Tester= new CSimpleFrame();
m_pMainWnd=Tester;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
};
CSimpleApp theApp;
该程序用于在vs2012中显示一个简单的窗口。 显然,我是Windows编程的新手。此外,在创建全局对象theApp之后,此错误开始出现。
我收到的错误如下。
Debug Assertion Failed!
Program: C:\Windows\system32\mfc110ud.dll
File: f:\\dd\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
Line: 196
**line 196 of appcore.cpp is**
ASSERT(AfxGetThread() == NULL);
When this error is shown i press retry.And then i press break and then continue then it gives another error
Debug Assertion Failed!
Program: C:\Windows\system32\mfc110ud.dll
File: f:\\dd\vctools\vc7libs\ship\atlmfc\src\mfc\appcore.cpp
Line: 203
**line 203 of appcore.cpp is**
ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
我遇到了同样的错误,并以此方式解决了我的问题。 如果有人遇到相同的问题,您可以使用此解决方案。
MFC编程中的这些问题通常发生在未正确设置项目设置时。 转到项目设置>链接器>系统
在子系统中选择:(/ SUBSYSTEM:WINDOWS)
这应该可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.