How to view printf output in a Win32 application on Visual Studio 2010?

后端 未结 7 1370
梦如初夏
梦如初夏 2021-02-01 05:48

How can you view printf output in a Win32 application (entering with a WinMain) in Visual Studio 2010?

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 05:52

    You'll need a console window. By far the easiest way to get one is to change a linker option: Project + Properties, Linker, System, SubSystem = Console. Add a main() method:

    int main() {
        return _tWinMain(GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW);
    }
    

提交回复
热议问题