If you have any further questions, please refer them to the MinGW mailing list. This page is updated by the MinGW Developers as time permits. The Q&A provided here were obtained from the MinGW mailing list, its members, various MinGW related web sites and experience. We would like to thank all who have contributed to this FAQ.

  1. What is mingw?
  2. Copyright issues
  3. msvcrt vs crtdll?
  4. Where to get mingw
  5. Using older versions
  6. How to install
  7. Mailing list
  8. Other compiler distributions
  9. Help
  10. Runtime libraries
  11. Debugging
  12. IDEs and editors
  13. Using mingw as a cross-compiler
  14. Compiling and building
  15. More compiling and building issues
  16. Compiler output
  17. COM support
  18. Make programs
  19. Patches
  20. GUIs/application frameworks/user interfaces
  21. Libraries
  22. Other programming tools
  23. How/where to report bugs
  24. Other resources

  1. What is MinGW?

    MinGW is a compiler system based on the GNU GCC and Binutils projects that compiles and links code to be run on Win32 (Windows) systems. It provides C, C++ and Fortran compilers plus other related tools. 'MinGW' refers to the "Minimalist GNU for Windows" project. If you see references to mingw32 instead of mingw, they are referring to the same compiler system. The project's name change from mingw32 to mingw is to prevent the implication that mingw will only works on 32 bit systems. As 64 and higher bit machines become more common, mingw will evolve to work with them. The project was originally started by Colin Peters, was taken over by Mumit Khan and is now maintained by a group of developers through the Sourceforge web site. Mingw uses the Microsoft runtime libraries, distributed with the Windows operating system. Unlike other ports of gcc to Windows, the runtime libraries are not distributed using Gnu's General Public License. You, therefore, do not have to distribute your source code with your programs.

    Back to index

    1. Mingw executables

      Gcc distributions such as mingw provide a gcc executable which can be used to compile files in any language the distribution supports. They also provide other compiler drivers, which in the case of mingw are executables such as g++, c++, g77, etc. These drivers invoke the appropriate compiler programs to compile your source code. Note that g++ and c++ are identical files except for the name difference. This is for historical purposes and allows backward compatibility with Unix compiler distributions which link c++ to g++. While you can compile and link different language files through the gcc program and the various other compiler drivers, it's recommended that you use the appropriate driver for the language you're working with. That way, determining what language specific libraries are needed and other language specific issues are all handled for you by the driver. The g++ and c++ executables are for C++, the g77 executable is for FORTRAN and the gcc executable is for C.

      Along with the compiler drivers, you'll find other tools in your bin directory. This includes cpp, a preprocessor which handles directives such as #include and #define. You'll also find windres, which is responsible for compiling Windows resource files into a usable format. The executables dlltool and dllwrap are programs used in creating and working with dlls (dynamic link libraries). The executable ar (i.e. archiver) lets you create and work with static libraries. The executable gdb is the Gnu debugger. Other executables are in this directory as well. For more information on these programs, see the Gnu documentation in the Help section.

  2. Back to index

  3. Copyright issues

    Various licenses come with Open Software. Some Open Software code requires you to redistribute your own source code when you add their code to your programs. Some source code is public domain and you can do whatever you like with it, including sell your own program which makes use of it. One of the nice features of mingw is that you can do whatever you wish with the programs you create using it and you are not required to distribute your own source code. You'll need a legal copy of crtdll.dll or msvcrt.dll on the Windows system the program will run on, but most Windows operating systems have one or both supplied with the operating system and they may be available from the Microsoft web site.

    For those interested in the actual legal details and technical points regarding copyright of the mingw compiler system, copyright information is included in the headers and the source files of the compiler distribution package. The following also applies:

    • The mingw basic runtime system, which is basically the glue to the underlying operating system, is completely in the public domain. The runtime system includes mingw headers (such as stdio.h), libraries (such as libmingw32.a) and import libraries for CRTDLL/MSVCRT.
    • W32API, which consists of the headers and import libraries related to WIN32 API access, is released under copyright. The copyright agreement states no restrictions are placed on programs or object files compiled with the library. There are restrictions if you wish to distribute the library as part of another package.
    • Mingw development tools, which include compilers, linkers, other tools in the bin directory, etc., are released under the GNU General Public License.
    • Profiled code, which is code compiled and linked with the -pg option for runtime profiling, also falls under the GNU General Public License.

    Here are some further reference sources for the various licenses that apply to pieces of the mingw distribution:

  4. Back to index

  5. msvcrt vs crtdll?

    Mingw requires the Microsoft runtime libraries. You'll need either crtdll.dll or msvcrt.dll on a system in order to run a program. There are two distributions of mingw, one for each runtime library option. Use the version of mingw for the type of runtime library you wish to work with. Which is better? That depends on what you need. Crtdll is on all Win32 systems, but is no longer updated. It is available on platforms such as Windows 3.11/Windows NT 3.5 and platforms that use Win32s. Msvcrt is not guaranteed to be on every Windows operating system, but it is more up-to-date and may offer more features. It handles threading better than crtdll and supplies functions such as _i64toa and _atoi64 that crtdll doesn't. There is a possibility that crtdll may not be supported in future releases of mingw.

  6. Back to index

  7. Where to get mingw?

    You can download mingw from http://www.mingw.org

  8. Back to index

  9. Using older versions?

    It's highly recommended that you use the latest version of mingw. There are older versions available on the Internet or through books and CDs. Older versions may have more bugs and can be more difficult to install or use than the latest version. Please be sure that you have downloaded and are working with the latest version, especially if you are having any difficulties with installation or use. If you are not sure of your version, you can type gcc -dumpversion to find out what you are using. The current version is 2.95.2.

  10. Back to index

  11. How to install?

    To install mingw, choose the distribution you want, either mingw using crtdll.dll or mingw using mscvrt.dll. Download the distribution. Unzip it. (Zip/unzip utilities are available from ftp://ftp.freesoftware.com/pub/infozip/.) If the bin directory that holds mingw executables isn't already in your path, add it. That's it.

    If you need help setting your path, try the following. On Windows NT, select Start/Settings/Control Panel/System/Environment and edit your path. For Windows 95/98, edit your autoexec.bat file. If you already have a line that starts with PATH or SET PATH, add the mingw bin directory to your list or you can add the following after the line that sets your path in autoexec.bat:
    SET PATH=C:\mingw32\bin;%PATH%
    Substitute the directory your mingw binaries (such as gcc.exe) are located in for C:\mingw32\bin. If your autoexec.bat file runs any other batch files at the end of it, be sure to place the lines to change your path before calling another batch file. For example, my autoexec.bat file has a line that runs a batch file to change the screen color when it's done setting everything else. When I place path changes after the batch file call, the path never gets updated. This is only a problem with calling other batch files (files with .bat extension). You can run programs like doskey from your autoexec.bat with no problem.

      Back to index

    1. Coexisting with djgpp

      Mingw can be installed and run when other compilers are on your machine.

      The important thing is that mingw needs to be able to find its executables in the file path. If you mix djgpp file paths with mingw file paths, you can have problems when your system tries to find the appropriate executables. If you must have both compilers' locations in your path, make sure the proper one comes first in the list. The safest situation is to only have the compiler you're working with listed in your current path. One solution djgpp users have found that lets them run both compilers is to create two batch files, one for each compiler. Set up correct paths and other environment variables in each batch file. Run the appropriate batch file before doing any compiling. Another solution is to create a link in Windows that will open up a DOS box and set the appropriate environment variables for each compiler through Windows.

  12. Back to index

  13. Mailing list

    There is a mailing list for mingw. You can join or find out more about it from http://lists.sourceforge.net/mailman/listinfo/mingw-users.

    The list covers announcements, information regarding compilation of various libraries using mingw, discussion of problems and work-arounds and other mingw related topics.

    1. The mingw32 mailing list archives are open to anyone, subscribers and non-subscribers alike. You can now post messages to the list even if you are not a subscriber.

    2. Just a reminder... Developers on this list all have their favorite tools, libraries and operating systems. Please be tolerant of other developers who don't necessarily want to work with your favorites. Thank you.

  14. Back to index

  15. Other compiler distributions

    Other compiler packages are available for Win32 systems. These include:

    • lcc-win from http://www.cs.virginia.edu/~lcc-win32/ is a Win32 C compiler complete with integrated environment. I believe the distribution includes a working GUI resource editor that has been reported to work with other compilers such as mingw.
    • bloodshed Dev-C++ from http://www.bloodshed.net/devcpp.html is a distribution of mingw32 with an IDE and other integrated tools.
    • rsxnt, rsxntdj from http://www.mathematik.uni-bielefeld.de/~rainer/ is used in conjunction with Gnu compilers on various platforms such as djgpp and emx to create Win32 executables.
    • Watcom from http://www.openwatcom.org/ is a collection of multi-platform C/C++ and Fortran compilers with integerated development environments. Sybase has recently agreed to release the Watcom compiler under an Open Source License under the management of SciTech Software Inc. Their plans are to work with other Open Source development groups once development of the new Open Source version commences. Check their web site for the latest news on Watcom development.
  16. Back to index

  17. Help

    1. Compiler, Win32 and C functions help files

      The following are URLs of sources for compiler, Win32, C++ or C function documentation available freely through the Internet.

      If you know of any other documentation, please mention it so it can be added to the list.

    2. Tutorials

      OpenGL Tutorials: Database Tutorials:
      • ODBC Oracle Example Program, ftp://ftp.simtel.net/pub/simtelnet/win95/prog/odbcora8.zip
        An example of how to write ODBC code. The Visual C++ version compiles with the mingw32 C compiler (although main really should be declared with a return value of int for mingw to be happy). When creating the executable, be sure to link in -lodbc32.
      C++ Tutorials:
  18. Back to index

  19. Runtime Libraries

    The gcc compiler series has been built successfully with many different runtime libraries. Mingw provides two different runtime library options, crtdll.dll and msvcrt.dll. See the msvcrt vs crtdll? section for more information. Both crtdll.dll and msvcrt.dll are available on most, if not all, Windows operating systems. The Cygnus gcc distribution uses the Cygnus runtime library which is available under the GNU General Public License. Similarly, the U/Win gcc distribution uses its own runtime library which is also available under the GNU General Public License. The main problem with using GPL'd runtime libraries is that all source must be distributed with the executables created by the compiler. When crtdll.dll or msvcrt.dll are used as runtime libraries this is not an issue.

    Other runtime libraries are usable with mingw/gcc. One such library in the works is PW32, the Posix-over-Win32 layer. It provides a subset of POSIX and UNIX functions. The Watcom runtime library source is now available for download from Sybase's web site on their download page. Another option might be to combine mingw with the Watcom runtime library.

    To find out more about PW32, try it out or volunteer to help, see http://pw32.sourceforge.net/

    If anyone manages to use mingw with the Watcom runtime library, please let me know so I can add details to the FAQ.

  20. Back to index

  21. Debugging

    1. Write statements

      The simplest method of debugging is to add write statements to the code in order to tell what's going on. In C, puts and printf are useful. In C++, cout is helpful. In Windows, the MessageBox is helpful as long as you don't call it during a paint routine. If you do anything in a Windows application that tries to repaint the screen during a paint call, you can get stuck in an infinite loop. Some programmers find using assert statements a good method to help debug.

    2. Map files and crash addresses

      If you can get the address of a program crash and you have a map file for your program, you can locate the line or routine where the program crashed.

      Certain systems, such as Windows NT and some Windows 98 machines, have a program named Dr. Watson available which will supply information about a program when it crashes. Some commercial compilers also supply a program with this functionality. If you have one of these programs available on your system, you can use the address of the crash supplied by it to help locate the problem. If anyone knows of any freeware programs that duplicate this functionality or has source code to find the address during a crash, please let me know.

      Here are three ways to create a map file. Choose the method you like best. In these examples, I've used sample names such as file.map and file.exe. Change the map, executable and object files to ones more relevant to your particular project.

      ld file.exe -Map file.map
      nm --extern-only --defined-only -v --print-file-name file.exe > file.map
      g++ -Wl,-Map,file.map -o file file.o otherfile.o

      On systems such as Windows NT, you can specify what application is run when a program crashes. To do so, edit the Debugger value for the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug registry key and change it to the program you want run after a crash. Windows makes available the ID of the process to debug and an event ID to signal when the debugger finishes calling DebugActiveProcess. These can be passed via command line to the program listed as Debugger. Setting the auto value for this registry key to 1 causes the program listed as Debugger to automatically run. Setting it to 0 brings up a crash dialog instead.

    3. Dr. MinGW

      Dr. MinGW is a just-in-time exception handler for mingw. See http://www.fe.up.pt/~em96115/gnu-win32/ for a copy. It will automatically install itself as the default debugger in the registry if run with the proper options. If you do not already have some debugger installed on your system, you may have to add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug to your registry by hand before successfully running the install option.

    4. Debugger

      For more in depth debugging, you will most likely need the help of a debugger program. Mingw includes gdb (Gnu debugger) in its distribution.

    5. GUI debugger

      Many people prefer a GUI front end to their debugger. Mingw currently does not supply this in its distribution. This leaves two options for GUI debuggers. Use one from another compiler distribution or use a GUI front end to gdb. Here are some links for both options.

      These are some GUI front ends to gdb:

      Check the Other compiler distributions section for other compilers with different debuggers.

  22. Back to index

  23. IDEs and editors

    1. What IDEs are available?

      There are several IDEs (Integrated Development Environments) for Win32 platforms. Some are freeware and some are not. Some are specifically tailored to mingw and others are for more general use.

    2. What editors are available?

    3. Other reference sites

      • Free Editors for C/C++ Programming with Windows at http://www.blockdev.net/Community/Editors/ lists other editor and IDE resources.
      • For those who prefer DOS editors, there are many good options such as edwin and pedit.
  24. Back to index

  25. Using mingw as a cross-compiler

    See http://www.nanotech.wisc.edu/~khan/software/gnu-win32/mingw-cross-howto.txt for definitive information regarding cross-compilers.

    Linux cross-compiler information, C/C++ binaries for Linux, plus links to various multimedia libraries are also available from http://www.devolution.com/~slouken/SDL/Xmingw32/. Thanks to Carl-Michael Kleffner for recommending this link.

  26. Back to index

  27. Compiling and Building

    1. How to create a console application

      Here's an example. The following is a code sample for a simple C program. Cut and paste it into a file named hello.c to try it out.

      #include <stdio.h>
      int main(int argc, char **argv)
         printf ("Hello\n");
         return (0);

      If you want to create a console mode executable hello.exe from a c file called hello.c, try the following:

      gcc -c hello.c

      This compiles hello.c into an object file, hello.o
      gcc -o hello hello.o

      This creates an executable hello.exe from hello.o

      Alternatively, you can compile and link in one step using:

      gcc -o hello hello.c 

      The following is a code sample for a simple C++ program. Cut and paste it into a file named hello.cpp to try it out.

      #include <iostream>
      int main(int argc, char **argv)
        cout << "Hello" << endl;
        return (0);

      For the C++ program, use the following to compile and link:

      g++ -c hello.cpp
      g++ -o hello hello.o
    2. How to create a windows application?

      Here's an example. The following is a code sample for a simple Windows program. Cut and paste it into a file named hello.c to try it out.

      #include <windows.h>
      int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) 
         MessageBox (NULL, "Hello", "Hello Demo", MB_OK);
         return (0);

      If you want to create a Windows executable hello.exe, from a c file called hello.c, try the following:

      gcc -c hello.c

      This compiles hello.c into an object file, hello.o
      gcc -o hello hello.o -mwindows

      This creates an executable hello.exe from hello.o The -mwindows switch is needed to create Windows executables instead of console applications. It assures the appropriate Windows libraries are linked in for you.

      To get a console screen along with a standard windows application, add the -mconsole flag as well as -mwindows.

      If you have resources from a resource file (.rc) that also need to be added to your executable, you'll need to compile the resource file as well as your other source files and include the compiled resources when linking to create the executable. Here's an example that shows how to compile and link in a resource file named resfile.rc.

      windres -o resfile.o resfile.rc
      gcc -o hello hello.o resfile.o -mwindows
    3. How to create a dll

      Here's an example. Cut and paste the following into a file named dllfct.h:

      #ifdef BUILD_DLL
      // the dll exports
      #define EXPORT __declspec(dllexport)
      // the exe imports
      #define EXPORT __declspec(dllimport)
      // function to be imported/exported
      EXPORT void tstfunc (void);

      Cut and paste the following into a file named dllfct.c:

      #include <stdio.h>
      #include "dllfct.h"
      EXPORT void tstfunc (void)
         printf ("Hello\n");

      Cut and paste the following into a file named hello.c:

      #include "dllfct.h"
      int main ()
         tstfunc ();
         return (0);

      To create the dll and an executable that uses it, try the following:

      gcc -c hello.c
      gcc -c -DBUILD_DLL dllfct.c
      dllwrap --output-lib=libtstdll.a --dllname=tst.dll --driver-name=gcc dllfct.o
      gcc -o hello.exe hello.o -L./ -ltstdll

      For more information on dlls, see http://www.nanotech.wisc.edu/~khan/software/gnu-win32/dllhelpers.html

    4. How to create a def file for a dll

      There are several methods that can be tried in order to create a definition file (.def) when one is not supplied.

      • One option is the tool, pexports. A version is available from http://www.is.lg.ua/~paul/devel/binutils.html. Another version is available from Anders Norlander's mingw32 page listed in the Other resources section. If your dll has functions that use the Pascal calling convention, you'll need to use the -o option.
      • Another option is the tool, impdef.
        More instructions on how to create def files from dlls, a copy of impdef and more information on how to use it are available at Colin Peters' site. See the Tutorials section.
        Other compilers may also supply versions of the impdef program that can be used to create a .def file which will work with any compiler. If you have another version of impdef from another compiler, you may wish to try it. Some handle the Pascal calling convention better than others. Borland has a version of impdef and other compiler utilities available for download at their Borland Community web site. Their Borland C++ version 5.5 compiler includes several utilities to help convert between standard formats, their formats and Microsoft's formats.
      • Another option is to use nm which comes with the mingw distribution.
        This option will not work for all dlls. Problems may occur if the dll is stripped or compiled as 16 bit. To use this technique, you'll need to filter the output from nm to create a def file. This can be done by hand in an editor or automated using tools like Perl (Practical Extraction and Report Language) or grep (global regular expression print) and sed (stream editor). Even with the automated methods, you may have to make some changes by hand if the Pascal calling convention is used by the dll. See Colin Peters' site for more details on this case. (Versions of sed and grep are available from various sites including archives that host gnuish MSDOS and archives such as Virtually Un*x that contain Win32 ports of common Unix tools and from the self-hosting mingw32 port distribution. The ActiveState version of Perl works well on Win32 platforms.) Here are examples of possible filtering techniques.
        • This example uses grep and sed. If you have a dll named file.dll that you wish to create a def file for named file.def, try the following:

          echo EXPORTS > file.def
          nm file.dll | grep ' T _' | sed 's/.* T _//' >> file.def

          To create a library file named file.a from the dll and def file, type:

          dlltool --def file.def --dllname file.dll --output-lib file.a
        • This example uses Perl. Copy the following Perl script to a file called dll.pl and use it:

          open (OUTFILE,">dll.def");
          print OUTFILE "EXPORTS\n";
          open (INFILE,"dll.fil");
             if ($_ =~ /T _/)
                $line = $_;
                $line =~ s/.* T _//;
                print OUTFILE $line;
          close (INFILE);
          close (OUTFILE);

          If you have a dll file named file.dll. At the command line, type:

          nm file.dll > dll.fil
          perl dll.pl

          A def file named dll.def will be created. You can rename this as needed. You'll also probably want to delete dll.fil when you're finished with this process.

        • If you don't have any of these tools on your system, you can still use nm to create a def file and edit it by hand through an editor. For example:

          nm file.dll > dll.fil
          find " T _" dll.fil > dll.def

          Replace the line at the top of dll.def that was created by the find program and shows a file name with a line that says EXPORTS. Set your editor to search for T _ and erase it and anything on the line before it, leaving only the routine names in the file.

      • If the previous options don't work, you can still try to create a def file using the output from the objdump program (from the mingw distribution).
        Here's an example.
        objdump -p file.dll > dll.fil

        Search for [Ordinal/Name Pointer] Table in dll.fil and use the list of functions following it to create your def file.
  28. Back to index

  29. More compiling and building issues

    1. main or WinMain?

      Windows programs use WinMain instead of main. However, mingw is set up so that you can use either.

    2. Why are my executable sizes large?

      Some users on the mingw32 mailing list have noticed ending up with unusually large executable sizes. This can happen if you leave in debugging information. To make your executables smaller, try linking with the -s switch or use the strip program on the final executable (not the object or library files). Compiling without the -g option is another alternative.

    3. Linking to other compilers' libraries

      Due to binary compatibility issues between different compilers, you cannot directly link in libraries or object code from one compiler to another compiler such as mingw and expect it to work. The reverse is true as well. Even dlls are not completely portable across compilers. To deal with this issue, various standards such as COM and CORBA were created.

      If you want to use a library or objects from one compiler with another, the easiest way to do it is to have the source (.c, .cpp, .rc, .def, etc.) and to compile and build that code with the desired compiler and its tools. You can use the same dll with different compilers with varying degrees of success. You'll need either a .def file or to use calls such as LoadLibrary/GetProcAddress to do so. The self-hosting version of mingw32 provides better support of Visual C++ binary compatibility. You can use certain libraries built with Visual C++ with this version of mingw32 without having to rebuild them using mingw and vice versa.

    4. Linking libraries

      If you place libraries before the object files that reference them, the linker will be unable to find them. The linker works left-to-right, single pass. The easiest way to avoid the problem is to place all libraries after the object files. It is also recommended that libraries to be linked with should not be repeated on the command line. While listing the same library more than once works with several linkers, the mingw linker currently has problems with this situation and may leave needed routines out of the link when this is done.

      Here's an example of a line that links in multiple objects and libraries:

      gcc -o hello hello.o util.o pdcurses.a -ltstdll

      The command links in the libraries pdcurses.a and libtstdll.a to create an executable hello.exe.

    5. Linking to dlls

      Although dlls are supposed to be fairly portable across different Windows compilers, accessing dlls through a library file (.lib or .a) is not. The library file formats are specific to particular compilers and cannot be used portably with different compilers unless the compiler provides support for it.

      There are two ways to link to a dll.

      • Provide a library file to let the program know what routines are in the dll and where to find them.
      • Use LoadLibrary/FreeLibrary and GetProcAddress.

      In order to use Microsoft or other compiler dlls, you can use any of the following methods:
      • Create def and library files. If you have the object files for the dll created using mingw, you can create a def file and a library file using the following method.
        dlltool --output-def file.def --output-lib libfile.a [list of objects]
        Substitute your object file names for [list of objects]. If you only have the dll file, see the How to create a def file for a dll section for alternative techniques. Once you have a def file, you can create a library file (.a) in the proper format for mingw using dlltool. For example:
        dlltool --def file.def --dllname file.dll --output-lib file.a
      • The self-hosting version of mingw32 has additional Microsoft compatible support and should allow you to link directly with library files in Microsoft .lib format. See the links in the Other resources section.
      • Use LoadLibrary/FreeLibrary and GetProcAddress. With this method, no library file (.lib or .a) is required. You can connect directly to the dll. LoadLibrary must be called before the dll can be accessed. FreeLibrary should be called before exiting the program. GetProcAddress is used to access specific functions in the dll by retrieving their addresses. You'll need to call GetProcAddress for each function from the dll you want to work with. Check a Win32 reference such as those found in the Help links for more information on the use of these functions.

      (Note: While C functions in dlls are generally portable across compilers, I'm told that this isn't necessarily true for C++. When writing your own dlls, you can mark C++ functions and data in dlls as extern "C" to help bridge some of the C++ portability issues between compilers. See the mingw32 mailing list archives for more portability concerns regarding dlls.)

    6. What are other useful compiler flags?

      You can get help by using the --help option.
      For example:

      gcc --help

      You can display the compiler version using the -dumpversion option.

      You can display the platform using the -dumpmachine option.

      You can specify include files not in your path by using -I.
      For example:

      gcc -c hello.c -I../pdcurses

      You can specify a directory for library files indicated by the -l option by using -L.

      You can use -g to add debug information for the debugger to work properly.

      You can use -D to specify a define.
      For example:

      gcc -c hello.c -D__WINDOWS__

      You can use -v to find out more about the executables being invoked.
      For example:

      gcc -v
  30. Back to index

  31. Compiler output

    1. Error redirection

      Mingw displays compilation and linking errors to stderr instead of stdout. To easily view these errors, you may need to redirect the output to stdout or a file. Some methods to do so include using one of the following programs:

    2. Keeping the dos box open

      Some users have had trouble with the dos box closing after building a program and haven't been able to see their errors. The mingw32 mailing list came up with several suggestions on how to deal with this. One suggestion from Franco Bez is as follows:

      By modifying a few Registry Keys - you can add a context menu item Run - stay open, so you simply right click on the Batch file and choose Run - stay open and your batch runs and stays open.

      The following Registry files do this and a little more:

      • context menu DOS Box for Folders and files - opens a dos box in the folder
      • context menu Notepad for all files, even those with missing/unknown extension - opens the file in Notepad for editing
      • context menu Run - stay open for bat, com and exe files

      Place the following lines in a file (such as Win95_98.reg or WinNT.reg) and simply merge the file for your system to your registry by doubleclicking it. The example below is for Windows NT. If you are using a Windows 95 or 98 system, change all the occurrences of cmd to command.com.

      @="DOS Box"
      @="Notepad.exe %1"
      @="DOS Box"
      @="cmd /k cd %1"
      @="R&un - Stay open"
      @="cmd /k %1"
      @="R&un - Stay open"
      @="cmd /k %1"
      @="R&un - Stay open"
      @="cmd /k %1"
  32. Back to index

  33. COM support

    Mingw has some support for COM programs. Programmers have had much better luck writing COM applications in C than C++. Work is in progress to improve support. Check the mingw32 mailing list archives for more details on COM and more links to example files.

  34. Back to index

  35. Make programs

    To keep from having to continually type all your compiler commands on the command line, working with a make program is one very good solution. There are several versions of make available both as freeware and commercially. Here are some URLs:

  36. Back to index

  37. Patches

    If you have changes to source code, it may be easier to distribute them as patches than to send the entire code to someone or list the changes by hand. Patching is an automated process of updating files using tools such as patch and diff.

    Patches can be created by comparing two files with the diff program or from various version control systems such as RCS. Several versions of diff have been ported to Windows and DOS. See sites such as Virtually Un*x listed in the Other programming tools section. There are also several versions of patch available for use in applying patches to source code. One site that includes it is Mumit's site also listed in the Other programming tools section. Detailed help information on using diff and patch and the various options available for working with them is also available in WinHelp format from the Virtually Un*x site.

    To create a patch, compare the two versions of the file with diff. Here's an example:

    diff --ignore-all-space old\file.cpp current\file.cpp > patch.fil

    The example ignores whitespace and compares the old version of file.cpp in directory old with the latest version in directory current. The output is redirected to a file. Most patches these days also include the -c or -u option which allows programmers to figure out what has changed in a file by viewing the context of the lines around it. Another common option is -r for working with entire directories instead of single files. The option -p may also be useful. It adds information on what C functions a change appears in.

    To patch a file, you'll need the original source file (old version) and the file with the patches created by diff. Here's an example of how to call patch:

    patch -o file.cpp ..\old\file.cpp patch.fil

    The command patches file.cpp in the old directory and outputs the updated file to file.cpp (specified by the -o option). Another useful switch for use with patch is -p which can affect the naming/location of files and can be used when working with compared directories.

  38. Back to index

  39. GUIs/application frameworks/user interfaces

    1. Can I use MFC or OWL?

      Mingw provides access to the Win32 API. Theoretically, if you own the MFC source code you could build MFC libraries for mingw. No one's tried this so far. If anyone does successfully accomplish it, please say so and it will be added to this document.

      For OWL owners, there is a port with additional features which supports various compilers including the gcc compiler line. See http://owlnext.starbase21.com/ for details. Thanks to Greg Chicares for supplying this information.

    2. What GUIs/application frameworks/user interface libraries are available?

      There are a number of these available. The following are known to have worked with mingw. There are several other libraries out there.

  40. Back to index

  41. Libraries

    If you've had luck with building other programming libraries and would like to see them added to the list, please e-mail information on where these libraries can be found and what you needed to do to build them.

    Here is a list of some of the libraries and programs that can be built with mingw.

    1. Graphics libraries

    2. Database libraries

    3. Other libraries

    4. Other programs

  42. Back to index

  43. Other programming tools

    I have links to various tools throughout the FAQ such as in the Make, IDEs and editors, Debugging and Other resources links, but here are some that weren't specifically mentioned elsewhere.

    1. Unix style tools

      Many users have found Win32 or DOS versions of Unix programming tools very helpful. Here are some places to find ports of well-known Unix tools.

    2. Other tools

      For those who prefer working with tools other than those found in Unix environments, here are some sites to check. If anyone else has favorite programming tools to add, feel free to suggest them.

      • DOS utilities, http://www.freedos.org/freedos/software/
        If you want utilities similar to standard MS DOS ones, check this site. It even includes a deltree version that works on Windows NT. All tools here are compiled for DOS 16 bit systems. Source is included with most.
  44. Back to index

  45. How/where to report bugs

    When sending in a bug report, please be sure to send a short example of the problem. If the problem cannot be recreated, it cannot be debugged. Also, see the list of known problems at http://www.nanotech.wisc.edu/~khan/software/gnu-win32/gcc.html before reporting a problem.

    You can now report bugs through the mingw site hosted at Sourceforge. You can also report bugs to cygwin. See http://gcc.gnu.org/faq.html#bugreport for more information. You can also bring problems up on the mingw32 mailing list.

  46. Back to index

  47. Other resources

    If anyone has any other mingw pages they've put together that they'd like to add, they can be placed here.

  48. Back to index

Valid XHTML 1.0!

Original document by Laura Michaels
Copyright © 1999-2000 All Rights Reserved
Last revised $Date: 2000/12/27 20:12:46 $