PDA

View Full Version : gcc question



Jaken Veina
07-11-2005, 08:40 PM
Truthfully, I use Windows, but since gcc was designed as a Linux compiler I figured I should ask here. Although, the question concerns Windows as well. If no one knows, I'll ask in another forum.

What does the -mwindows option do, specifically. I know that it's required to compile Win32 Programs, but it's not listed in the GCC online documentation. -M is, but that's not what I'm looking for. I'm thinking this option might be unique and it just tells the compiler to #define something that's required for windows.h headers. But, I'm also thinking it might be a -m option passed the argument windows, similar to -l. But this doesn't seem right to me either, because I've searched my includes and libraries and the only file with the name windows is windows.h. Can anyone enlighten me?

^xor
07-12-2005, 02:04 AM
It makes the program an actual Windows executable instead of a console application by linking the proper Windows libraries for you.

Jaken Veina
07-12-2005, 09:58 AM
I figured something as much. So, it is a unique option, not an extension of an -m option.

Ken Fitlike
07-14-2005, 04:58 PM
-mwindows is a linker switch that ensures the basic windows libs are linked (kernel32, gdi32, user32, comdlg32 and, possibly, shell32) and prevents a console being created similtaneously with the gui window ie. it ensures that a non-console, windows gui application is created.

The non-console behaviour can be overridden with the -mconsole linker switch ie. -mwindows -mconsole creates both a gui window and a console when the executable is run.

The -mwindows switch is synonymous with -Wl,--subsytem,windows.

It won't be listed in gcc online because, as far as I know, it's a windows specific (mingw and, presumably, cygwin) linker switch.

This is hardly a linux question, BTW.

Jaken Veina
07-15-2005, 12:53 PM
I was afraid of that. Sorry.