Cocos2dx 添加输出控制台

2023-07-26  本文已影响0人  Lennie_S

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();
}
上一篇 下一篇

猜你喜欢

热点阅读