在main.cpp中
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
最后记得要释放,不然后会有内存泄露
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
FreeConsole();
#endif