美文网首页
Cocos2dx 添加输出控制台

Cocos2dx 添加输出控制台

作者: Lennie_S | 来源:发表于2023-07-26 17:07 被阅读0次

    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();
    }
    

    相关文章

      网友评论

          本文标题:Cocos2dx 添加输出控制台

          本文链接:https://www.haomeiwen.com/subject/sqbkpdtx.html