visual-studio - 将stdout和stderr重定向到Microsoft Visual Studio的输出调试控制台

标签 visual-studio visual-c++ mfc

我正在使用Microsoft Visual Studio做C ++。
我在IDE的输出控制台中看不到std :: err和std :: out。
有没有办法重定向他们?

最佳答案

您确实可以重定向std :: out和std :: err。只需在解决方案资源管理器中右键单击您的项目,然后选择Properties。然后选择Configuration Properties -> Debugging并将适当的参数放入Command Arguments字段。例如,要将std :: err重定向到文件,我将输入2> ErrorLog.txt

在Visual Studio运行程序时,您在Command Arguments中键入的内容仅作为命令行参数附加,就像您在控制台中手动键入它们一样。因此,以上示例仅告诉VisualStudio使用命令<programName>.exe 2> ErrorLog.txt而不是<programName>.exe运行您的程序。

关于visual-studio - 将stdout和stderr重定向到Microsoft Visual Studio的输出调试控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2683249/

相关文章:

c++ - 与 MFC 的 CString 连接的最合适的方法是什么

visual-c++ - 向 VC++ 应用程序添加 AES 加密

visual-studio - 为什么 VS 2015 菜单右对齐?

visual-studio - 如何暂时停用所有 try/catch block ?

c++ - 将超时设置为 recv 函数

c# - 依赖于 Visual C++ 2013 运行时的 NuGet 包

c++ - `is_trivially_destructible` 不适用于继承类

c++ - exe在同一目录下找不到文本文件

javascript - 用于 Backbone.js 的 Visual Studio Intellisense

c++ - 如何将CEdit类型的数据转换为CString类型的数据以及如何将其显示在消息框中?