GUI程序显示console
在main函数前加入:
#include "windows.h"
#pragma comment( linker, "/subsystem:\"console\" /entry:\"wWinMain\"" ) // 设置入口地址int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow){
。。。。
其中红色字体可能根据是否支持UNICODE修改为WinMain
dos程序不显示console
#include "windows.h"
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) // 设置入口地址
void main(void)
{
…
}
本文介绍如何在GUI程序中显示Console窗口,通过调整链接器设置和使用特定的入口函数实现。适用于需要同时拥有图形界面和命令行输出的应用场景。
7578

被折叠的 条评论
为什么被折叠?



