I just try to write a little game with DirectX.
Therefore I need a console for writing Debug Informations.
I googled and found the function AllocConsole()
.
The function works fine, but after the console openes it closes itself and the DirectX Application.
Does somebody know how I can run a DirectX Application and a Console simultaneous?
Asked
Active
Viewed 701 times
0

CrazySocke
- 13
- 5
-
When compiling there is a flag that suppresses the console, if you remove that, you should be able to see the console to... never mind. – Evan Carslake Mar 07 '15 at 18:04
-
Another option to dump debug information is [OutputDebugString](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362.aspx). The output shows up in Visual Studio's *Output* pane, when the application is run under the debugger. When not running under a debugger, the output can be logged using tools like [DebugView](https://technet.microsoft.com/en-us/library/bb896647.aspx). – IInspectable Mar 07 '15 at 18:18
-
What I do is create the console in a separate thread. Then I redirect the cin and cout functions to the console. You can probably try that. – Brandon Mar 07 '15 at 18:42
1 Answers
0
Allocating your own console is unnecessary, most of the times its only needed when you want multiple console, heres how you enable the inbuilt one : https://stackoverflow.com/a/1152873/351861

Community
- 1
- 1

specializt
- 1,913
- 15
- 26
-
A process cannot be attached to multiple consoles. See [AllocConsole](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681944.aspx): *"A process can be associated with only one console, so the **AllocConsole** function fails if the calling process already has a console."* – IInspectable Mar 08 '15 at 00:45
-
-
exactly. One call in each new process - or else manual console-creation and pipe-control would be required. – specializt Mar 08 '15 at 11:43