在MinGW编译器中,-mwindows命令是什么,它做什么用? [英] In the MinGW compiler, what is the -mwindows command, and what does it do?

查看:108
本文介绍了在MinGW编译器中,-mwindows命令是什么,它做什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用C ++程序时遇到问题,当我运行.exe时,该程序将运行,并且该程序的窗口将打开,但控制台将在后台的桌面上打开.我进行了一次Google搜索,发现使用-mwindows命令作为参数进行编译会删除控制台.它做到了.但是我不确定它的实际作用,我很好奇.

I was having an issue with a C++ program where when I ran the .exe the program would run and my window for the program would open, but the console would be open on the desktop in the background. I did a google search and found that compiling with the -mwindows command as an argument, removes the console. Which it did. But I'm unsure of what it actually does and I am curious.

推荐答案

它的行为与在MSDN 上描述的/subsystem:windows 开关.

It behaves exactly the same as the /subsystem:windows switch described on MSDN.

基本上,它将入口点设置为 WinMain (或 wWinMain ),而不是 main (或 wmain )),导致没有控制台窗口,并且运行了一些Win32启动代码来创建传递给 WinMain 的参数.正如尼尔所说,它不会阻止或启用您没有它就无法做的任何事情.

Basically, it sets the entry point to WinMain (or wWinMain) instead of main (or wmain), which results in no console window and some Win32 startup code running to create the arguments passed to WinMain. As Neil says, it does not prevent or enable anything you can't do without it.

类似的开关是 -municode ,用于在 main / WinMain wmain / wWinMain之间切换,Microsoft工具未对其进行镜像.这些似乎会自动选择您要使用的那个).

A similar switch is -municode to switch between main/WinMain and wmain/wWinMain, which is not mirrorred by the Microsoft tools. These seem to automagically select the one you use).

这篇关于在MinGW编译器中,-mwindows命令是什么,它做什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆