[英]Is it possible to debug in console in a Win32 C++ Application in Visual Studio?
As the question mentions, I am finding it hard to debug and output in a Win32 Windows Program in Visual Studio. 正如问题所提到的,我发现很难在Visual Studio的Win32 Windows程序中进行调试和输出。 I have used SDL2.0 for OpenGL Projects and SDL window opens with the console as well, so it becomes easy to debug and output anything on the console anytime.
我已经将SDL2.0用于OpenGL项目,并且SDL窗口也随控制台一起打开,因此可以随时在控制台上轻松调试和输出任何内容。 How can I achieve this in Win32 API?
如何在Win32 API中实现此目标? Is it anyhow possible to open the console in a Win32 application?
是否可以在Win32应用程序中打开控制台?
You can do this via the AttachConsole and/or AllocConsole functions of the Windows Console API (see https://docs.microsoft.com/en-us/windows/console/console-functions ). 您可以通过Windows控制台API的AttachConsole和/或AllocConsole函数来执行此操作(请参阅https://docs.microsoft.com/zh-cn/windows/console/console-functions )。 You can also simply create a Console Application in your IDE, and call your GUI code from that application.
您也可以在IDE中简单地创建一个控制台应用程序,然后从该应用程序中调用您的GUI代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.