在 Windows 上调试时,stderr 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1343320/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When debugging on Windows where does stderr go?
提问by fbrereto
When trying to debug a program on Windows I can't seem to find where the output I push to stderr is going. How do I get a hold of my stderr output? Is there a debugger-level setting (MSVC 9) I can change to redirect stderr to some part of the UI?
尝试在 Windows 上调试程序时,我似乎无法找到我推送到 stderr 的输出的去向。如何获取我的 stderr 输出?是否有调试器级别设置 (MSVC 9) 我可以更改以将 stderr 重定向到 UI 的某些部分?
Update: I have not looked into TRACE
or OutputDebugString
, but the code base is cross-platform, so platform-specific APIs, while not totally off the table, are secondary to a standards-compliant solution.
更新:我没有研究TRACE
or OutputDebugString
,但代码库是跨平台的,因此特定于平台的 API 虽然并非完全不在表中,但对于符合标准的解决方案来说是次要的。
采纳答案by Byron Whitlock
When you have a GUI process stderror should show up in the output window in visual studio. You can open a new console window if you want to have the output go there.look at the output. See my answer to this question.for details.
当你有一个 GUI 进程时,stderror 应该显示在 Visual Studio 的输出窗口中。如果您想让输出转到那里,您可以打开一个新的控制台窗口。查看输出。请参阅我对这个问题的回答。详情。
回答by John Lockwood
Another approach, using files:
另一种方法,使用文件:
http://msdn.microsoft.com/en-us/library/aa236457(VS.60).aspx
http://msdn.microsoft.com/en-us/library/aa236457(VS.60).aspx