【问题标题】:Compiling a Win32 GUI app (without a console) using MinGW and Eclipse使用 MinGW 和 Eclipse 编译 Win32 GUI 应用程序(没有控制台)
【发布时间】:2011-11-20 10:19:38
【问题描述】:

我正在使用带有 MinGW 作为编译器的 eclipse IDE 来制作 Win32 GUI 应用程序。

我想去掉控制台,但是用-mwindows选项编译程序没有效果,控制台还在。

使用-Wl,--subsystem,windows 标志也不会产生任何效果。我做错了什么?

【问题讨论】:

  • 您使用的是什么 GUI 工具包?

标签: c++ eclipse gcc mingw


【解决方案1】:

对于 Windows 上的 gcc,构建非控制台 Windows 应用程序应考虑两件事:

  1. 编译器选项-mwindows
  2. WinMain()

但是,可以手动将-Wl,-subsystem,windows 指定给链接器并将gdi32comdlg32 包含到构建中。这正是 -mwindows 自动执行的操作。

Reference.

【讨论】:

    【解决方案2】:

    试试 --machine-windows 选项。当我构建 asm 代码时它对我有帮助:

    nasm -f win64 hello.asm
    gcc hello.obj --machine-windows -o hello
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-19
      • 2010-11-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多