使用MinGW和Eclipse编译Win32 GUI应用程序(无控制台) [英] Compiling a Win32 GUI app (without a console) using MinGW and Eclipse

查看:143
本文介绍了使用MinGW和Eclipse编译Win32 GUI应用程序(无控制台)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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:


  1. 编译器选项 -mwindows

  2. WinMain()

  1. Compiler option -mwindows
  2. 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屋!

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