使用MinGW和Eclipse编译Win32 GUI应用程序(无控制台) [英] Compiling a Win32 GUI app (without a console) using MinGW and Eclipse
问题描述
我使用eclipse IDE与MinGW作为我的编译器,做一个Win32 GUI应用程序。
I'm using the eclipse IDE with MinGW as my compiler, to make a Win32 GUI app.
我想摆脱控制台,但使用 -mwindows
选项编译程序没有效果,控制台仍然存在。
I want to get rid of the console, but compiling the program with -mwindows
option has no effect and the console is still there.
使用 -Wl, - subsystem,windows
标志也没有效果。
Using the -Wl,--subsystem,windows
flag also produces no effect. What am I doing wrong ?
推荐答案
对于Windows上的gcc,应该考虑两个方面来构建非控制台Windows应用程序:
For gcc on Windows, two things should be considered to build a non-console Windows app:
- 编译器选项
-mwindows
- 有
WinMain()
- Compiler option
-mwindows
- Have
WinMain()
但是, code> -Wl,-subsystem,windows 到链接器,并包括 gdi32
和 comdlg32
进入构建。这正是 -mwindows
自动化的原因。
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.
参考。
这篇关于使用MinGW和Eclipse编译Win32 GUI应用程序(无控制台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!