使用 MinGW 和 Eclipse 编译 Win32 GUI 应用程序(没有控制台)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7474504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compiling a Win32 GUI app (without a console) using MinGW and Eclipse
提问by viraj
I'm using the eclipse IDE with MinGW as my compiler, to make a Win32 GUI app.
我使用 Eclipse IDE 和 MinGW 作为我的编译器,来制作一个 Win32 GUI 应用程序。
I want to get rid of the console, but compiling the program with -mwindows
option has no effect and the console is still there.
我想摆脱控制台,但是使用-mwindows
选项编译程序没有任何效果,控制台仍然存在。
Using the -Wl,--subsystem,windows
flag also produces no effect. What am I doing wrong ?
使用-Wl,--subsystem,windows
标志也不会产生任何效果。我究竟做错了什么 ?
回答by Andrejs Cainikovs
For gcc on Windows, two things should be considered to build a non-console Windows app:
对于 Windows 上的 gcc,构建非控制台 Windows 应用程序应考虑两件事:
- Compiler option
-mwindows
- Have
WinMain()
- 编译器选项
-mwindows
- 有
WinMain()
It is possible, however, to manually specify -Wl,-subsystem,windows
to the linker and include gdi32
and comdlg32
into the build. This is exactly what -mwindows
automates.
这是可能的,但是,手动指定-Wl,-subsystem,windows
给连接器,包括gdi32
与comdlg32
到构建。这正是-mwindows
自动化的原因。
参考。