提问人:user366312 提问时间:10/30/2023 最后编辑:user366312 更新时间:10/30/2023 访问量:99
在 VS2017 中手动创建 MFC 应用程序
Creating an MFC application manually in VS2017
问:
我正在尝试在 VS2017 下编译一个 MFC 应用程序。
我从一个空的 C++ 项目创建了这个应用程序。
#include <afxwin.h>
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance()
{
CFrameWnd* pFrame = new CFrameWnd;
if (!pFrame)
return FALSE;
pFrame->Create(NULL, _T("Minimal MFC Application"));
m_pMainWnd = pFrame;
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}
};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CMyApp app;
AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
return app.Run();
}
然后我通过链接添加了 和 。nafxcwd.lib
libcmtd.lib
然后我设置
MyProjet
->Properties
->Configuration Properties
->C/C++
->Code Generation
->Runtime Library
->Debug
=/MDd
MyProjet
->Properties
->Configuration Properties
->C/C++
->Code Generation
->Runtime Library
->Release
=/MD
现在,我收到以下错误:
1>------ Rebuild All started: Project: Project2, Configuration: Debug Win32 ------
1>Source.cpp
1>_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcmtd.lib(delete_scalar.obj)
1>C:\Users\pc\source\repos\Project2\Debug\Project2.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Done building project "Project2.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
如何解决此错误?
答: 暂无答案
评论