在你项目目录下,win32的main.cpp文件中添加如下代码
#include “main.h”
#include “SimulatorWin.h”
#include <shellapi.h>
USING_NS_CC;
// uncomment below line, open debug console
#define USE_WIN32_CONSOLE
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen(“CONIN " , " r " , s t d i n ) ; f r e o p e n ( " C O N O U T ", "r", stdin); freopen("CONOUT ","r",stdin);freopen("CONOUT”, “w”, stdout);
freopen(“CONOUT$”, “w”, stderr);
#endif
auto simulator = SimulatorWin::getInstance();
return simulator->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
}
重新运行一下项目,oK