WINEGCC(1)

🍷 WINEGCC(1) β€” the Wine Developers Manual, bestie edition ✨

okay so real talk: this is winegcc, the Wine C and C++ MinGW Compatible Compiler, straight out of the Wine Developers Manual. buckle up, we're building Windows apps on Linux and it's gonna slay πŸ’…


✨ NAME ✨

winegcc β€” the Wine C and C++ MinGW Compatible Compiler. that's it, that's the girl πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

winegcc [options] infile...

πŸ’– DESCRIPTION πŸ’–

winegcc is a gcc wrapper, and her whole personality is trying to provide a MinGW compatible compiler under Linux πŸ”₯ this is so useful for Win32 developers, because you can literally just take your MinGW code from Windows and recompile it without modifications under Winelib on Linux. no cap. and heads up: wineg++ accepts mostly the same options as winegcc, so you're not learning two whole things 🫢

the goal of winegcc β€” the dream, the vision β€” is to be able to simply replace gcc/g++/windres with winegcc/wineg++/wrc in a MinGW Makefile, and just recompile the application using Winelib under Wine. periodt. while typically there are small adjustments that must be made to the application source code and/or Makefile, it's quite easy to do them in a fashion that's compatible between the MinGW and Wine environments. icon behaviour, honestly πŸ‘‘

and this manual? it documents only the differences from gcc. for more info on those other options, please consult the gcc manual. iykyk πŸ“–


🌈 OPTIONS 🌈

gcc options: all gcc options are supported, and are passed along to the backend compiler. all of them. every single one. she's generous like that πŸ’œ

  • -b, --target target β€” specify the target architecture triplet for cross-compiling. winegcc will then invoke target-gcc instead of gcc. cross-compile era πŸ’«
  • --wine-objdir dir β€” specify the Wine object directory. this gets used when building Wine itself, to use the includes and libraries from inside the build tree. very "inside baseball" of her 🧚
  • --winebuild name β€” specifies the path and name of the winebuild binary that will be launched automatically by winegcc. if not set, winegcc will look for a file named winebuild in the path. this takes precedence over the WINEBUILD environment variable. she said precedence, she said i'm the main character πŸ‘‘
  • -fno-short-wchar β€” override the underlying type for wchar_t to be the default for the target, instead of using short unsigned int, which is the default for Win32. little type-system glow-up ✨
  • -mconsole β€” this option passes '--subsystem console' to winebuild, to build console applications. it is the default. so if you do nothing, congrats, you already did this πŸŽ€
  • -mno-cygwin β€” use Wine implementation of MSVCRT, instead of linking against the host system libc. this is necessary for the vast majority of Win32 applications, as they typically depend on various features of MSVCRT. this switch is also used by the MinGW compiler to link against MSVCRT on Windows, instead of linking against Cygwin libc. sharing the syntax with MinGW makes it very easy to write Makefiles that work under Wine, MinGW+MSYS, or MinGW+Cygwin. one Makefile, three environments, she's versatile like that πŸ’…
  • -municode β€” set the default entry point of the application to be the Unicode wmain() instead of the standard main(). unicode entry point, we love to see it 🌸
  • -mwindows β€” this option adds -lgdi32, -lcomdlg32, and -lshell32 to the list of default libraries, and passes '--subsystem windows' to winebuild to build graphical applications. GUI girlies rise πŸ–ΌοΈ
  • -nodefaultlibs β€” do not use the standard system libraries when linking. these include at a minimum -lkernel32, -luser32, -ladvapi32, and any default libraries used by the backend compiler. the -mwindows option augments the list of default libraries as described above. so like, remember that whole bit? yeah, that still applies 🫠
  • -nostartfiles β€” do not add the winecrt0 library when linking. skipping the starter pack, bold move πŸ’€
  • -Wb,option β€” pass an option to winebuild. if option contains commas, it is split into multiple options at the commas. comma-separated, she's splitting, she's parsing πŸ“
  • -Wl,--out-implib,lib.a β€” when linking a dll, also create its corresponding import library. two for one, we stan a productive queen πŸ‘‘

🌸 ENVIRONMENT 🌸

  • WINEBUILD β€” specifies the path and name of the winebuild binary that will be launched automatically by winegcc. if not set, winegcc will look for a file named winebuild in the path. (yes, this is the same deal as --winebuild, except the flag wins. she said remember the precedence 😌)

⭐ DEFINES ⭐

winegcc defines __WINE__, for code that needs to know when it's being compiled under Wine. it also defines WIN32, _WIN32, __WIN32, __WIN32__, __WINNT, and __WINNT__ for compatibility with MinGW. so many defines, all of them iconic, all of them spelled exactly like that πŸ”₯


πŸ’€ BUGS πŸ’€

warning, bestie, read this part. she's got limitations and she's being honest about it.

the dllimport/dllexport attributes are not supported at the moment, due to lack of support for these features in the ELF version of gcc. not me crying about it 😭

static linking is not currently supported against Wine DLLs. as a result, the -static, --static, and -Wl,-static options will generate an error. do not pass those. i'm serious. it will error. πŸ™ˆ

bugs can be reported on the Wine bug tracker. go snitch, it's for the greater good πŸ›


🧚 AUTHORS 🧚

winegcc was written by Dimitrie O. Paun. thank you for your service, king 🫑


πŸ‘‘ AVAILABILITY πŸ‘‘

winegcc is part of the Wine distribution, which is available through WineHQ, the Wine development headquarters. go get her πŸ’–


🌈 SEE ALSO 🌈

gcc(1), winebuild(1), wrc(1), wine(1), Wine documentation and support. the whole friend group, honestly πŸŽ€


and that's the page! this one dropped with Wine 11.21 and is dated October 2005 β€” vintage, but still serving. mwah πŸ’‹