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

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

问题描述

我正在使用MinGW的eclipse IDE作为我的编译器,制作一个Win32 GUI应用程序。



我想摆脱控制台,但使用 -mwindows 选项编译程序没有任何效果,控制台仍然存在。



使用 -Wl, - 子系​​统,windows 标志也不产生影响。我在做错什么?

解决方案

对于Windows上的gcc,应该考虑建立一个非控制台Windows应用程序的两件事情:


  1. 编译器选项 -mwindows

  2. WinMain()

然而,可以手动指定 -Wl,-subsystem,windows 到链接器,并包含 gdi32 comdlg32 进入构建。这就是 -mwindows 自动化。



参考


I'm using the eclipse IDE with MinGW as my compiler, to make a Win32 GUI app.

I want to get rid of the console, but compiling the program with -mwindows option has no effect and the console is still there.

Using the -Wl,--subsystem,windows flag also produces no effect. What am I doing wrong ?

解决方案

For gcc on Windows, two things should be considered to build a non-console Windows app:

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

Reference.

这篇关于使用MinGW和Eclipse编译Win32 GUI应用程序(无控制台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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