C++: No output from cout object

Started by
11 comments, last by adeyblue 14 years, 11 months ago
Quote:I wrote a simple Windows Form application


You created a Windows Forms Application from the CLR tab. You should be creating a Win32 Console Application or Win32 Project under the Win32 tab.

I just tested using a CLR project and got the same results as you did with OutputDebugString failing to output. I don't know why that's the case, but it works under normal Win32 projects just fine. I would suggest you recreate your project as a Win32 Console project unless you are intentionally wanting to use a CLR styled project (which I would think you aren't after that at this point).
Advertisement
Quote:Original post by visitor
I wonder though, why would the program exit so abruptly that flushing is necessary. If it is for debugging, then you could use std::cerr which should flush each output automatically.


Seriously? Wish I'd known that about a year ago.

Quote:Original post by Drew_Benton
I just tested using a CLR project and got the same results as you did with OutputDebugString failing to output. I don't know why that's the case, but it works under normal Win32 projects just fine.


VS only attaches the managed debugger to /clr:pure projects by default. The native portion of the debugger needs to be attached for OutputDebugString to be effective. Switch the
Project Properties->Configuration Properties->Debugging->Debugger Type option to Mixed and it'll work.

This topic is closed to new replies.

Advertisement