在InitInstance()中添加就能生成一个console.
#ifdef _DEBUG
if (!AllocConsole())
AfxMessageBox("Failed to create the console!", MB_ICONEXCLAMATION);
#endif
当然,必须在 程序 结束时进行收尾,在ExitInstance()中添加:
#ifdef _DEBUG
if (!FreeConsole())
AfxMessageBox("Could not free the console!");
#endif
在程序中需要输出调试信息的地方,可以运用这个调试窗口了:
_cprintf("Local value is %d/n", m_variable);
_cprintf的用法同printf一样。当然,要使用它,必须包含conio.h
#include <conio.h>
OK! That's all!
#ifdef _DEBUG
if (!AllocConsole())
AfxMessageBox("Failed to create the console!", MB_ICONEXCLAMATION);
#endif
当然,必须在 程序 结束时进行收尾,在ExitInstance()中添加:
#ifdef _DEBUG
if (!FreeConsole())
AfxMessageBox("Could not free the console!");
#endif
在程序中需要输出调试信息的地方,可以运用这个调试窗口了:
_cprintf("Local value is %d/n", m_variable);
_cprintf的用法同printf一样。当然,要使用它,必须包含conio.h
#include <conio.h>
OK! That's all!