Thread: gcc question

  1. #1
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256

    gcc question

    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?
    Code:
    void function(void)
     {
      function();
     }

  2. #2
    FOX
    Join Date
    May 2005
    Posts
    188
    It makes the program an actual Windows executable instead of a console application by linking the proper Windows libraries for you.

  3. #3
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    I figured something as much. So, it is a unique option, not an extension of an -m option.
    Code:
    void function(void)
     {
      function();
     }

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    -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.
    Last edited by Ken Fitlike; 07-14-2005 at 07:57 PM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    I was afraid of that. Sorry.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question - linux - gcc - c standards
    By AMAMH in forum C Programming
    Replies: 12
    Last Post: 12-03-2009, 02:49 AM
  2. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  3. Gcc can't find obvious copy constructor
    By SevenThunders in forum C++ Programming
    Replies: 13
    Last Post: 03-19-2009, 02:41 PM
  4. Quick Compilation Question
    By chacham15 in forum C Programming
    Replies: 10
    Last Post: 10-12-2008, 08:15 PM
  5. Question about linux compiling with GCC
    By elsheepo in forum C++ Programming
    Replies: 23
    Last Post: 03-07-2008, 11:36 PM