问题
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?
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.
回答1:
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.
回答2:
Another approach, using files:
http://msdn.microsoft.com/en-us/library/aa236457(VS.60).aspx
来源:https://stackoverflow.com/questions/1343320/when-debugging-on-windows-where-does-stderr-go