I try to send debug mesage with OutputDebugString function. I use this function in my dll project and i get this message in DebugView. I also use this function in my console app project(same solution) but i can't get messages. All messages appear in the DebugView except for the console application. It does not even appear the simple OutputDebugStringA("debug");
or OutputDebugString(L"debug");
codes. What could it cause?

- 81
- 1
- 10
-
1Sounds like it would be easy for you to provide a [mcve] – Thomas Weller Dec 03 '16 at 12:41
-
I'm not sure what you mean. Do you expect the debug output to appear in the console window? It will not. Use `std::cout << "message";` for that. – Violet Giraffe Dec 03 '16 at 12:42
-
@Burak Kocaman, any update? Could you share us the latest information about this issue? – Jack Zhai Dec 06 '16 at 09:43
1 Answers
One issue is that whether you visit it in your VS output window or the tool DebugView here: https://technet.microsoft.com/en-us/sysinternals/bb896647?f=255&MSPPError=-2147217396. They are different.
If you use the Debug view, not debug your app, just run it using "start without debugging(Ctrl+F5)".
If you use the VS output window and other apps output normally, just the specific console app has this issue, I don't think it is related to the debugger tool, we would think about the project itself or VS Settings.
(1)Please set a breakpoint in the code line "OutputDebugString(L"debug");", and then debug your app using "F5", after the breakpoint was hit, click "Step Into (F11)", and then visit your debug output window. Maybe the specific line code was not called in your side.
(2)Since there are different projects in the same solution, please set this console app as the start up project. Or you could just create a single solution for this project, debug it again. At least, we could know that whether other projects impact this specific console app.
(3) Just test it in other VS IDE, make sure that it is not the VS IDE issue. I just use the default VS settings in my side, it works well.
Reference:
https://blogs.msdn.microsoft.com/reiley/2011/07/29/a-debugging-approach-to-outputdebugstring/

- 6,230
- 1
- 12
- 20