Redirect Console.Write… Methods to Visual Studio's Output Window While Debugging

前端 未结 7 1403
死守一世寂寞
死守一世寂寞 2020-12-03 04:47

From a Console Application project in Visual Studio, I want to redirect Console\'s output to the Output Window

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 05:16

    Thanks, Alex F, nice solution, but didn't work for me, because my project was created by cmake. So, to do as Alex F suggested, add WIN32 or MACOSX_BUNDLE to add_executable

    add_executable(target_name WIN32 )
    

    Or, if you can't edit the CMakeList.txt, you can add -DCMAKE_WIN32_EXECUTABLE=1 to the cmake configure command.

提交回复
热议问题