1.查看新建项目里面的win32/main.cpp.
2.修改入口函数内容
#include "main.h"
#include "SimulatorWin.h"
#include <shellapi.h>
#define USE_WIN32_CONSOLE //加入
int WINAPI _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
//auto simulator = SimulatorWin::getInstance(); //屏蔽
//return simulator->run(); //屏蔽
int ret = SimulatorWin::getInstance()->run(); //下面加入
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
return ret;
}
3.重新编译运行就可以了。
zhoumo753 发布了4 篇原创文章 · 获赞 0 · 访问量 1575 私信 关注