main.cpp 加上下面这段话:
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
USE_WIN32_CONSOLE 变量没有定义,
加上 #define USE_WIN32_CONSOLE
完整代码:
/****************************************************************************
#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();
}