FIXME: This page may have a number of dangling links, as a result of incomplete import of pages referenced from the old MinGWiki FAQ. If you find such a link, please help out, by copying and reformatting the originally referenced page content to this new wiki, to create the missing page, and link to it.
What is ...
When is ...
- ... TheNextRelease?
Where is ...
- ... pthreads library?
Why is ...
- ... My executable so large?
- ... My executable is sometimes different?
- ... Building a program giving me error messages?
- ... The compiler giving internal compiler errors?
- ... The linker consistently giving undefined references?
How do I ...
- ... Ask for help?
- ... Configure RXVT?
- ... Report bugs?
- ... Submit patches?
- ... Contribute to MinGW?
- ... Compile a JAVA program?
- ... Use more recent defined functions?
- ... Specify the libraries for the linker to use?
- ... Use the thread library?
- ... Build a Linux hosted MinGW cross compiler?
- ... Build a MinGW hosted cross compiler?
- Why can't the MinGW compilers find my project's header files?
- Why don't wide characters work with libstdc++?
- The wide-character parts of the GCC Standard C++ Library (libstdc++) have not yet been fully ported to Windows. Alternatives and discussion on this can be found here.
- Why can't I mix objects from different Compiler Brands or mix objects from different compiler versions of the same compiler brands?
- This issue is not specific to MinGW: many compilers are mutually incompatible.
- How do I remove DOS command windows?
- In the link step add a "-mwindows" switch to the command line.
- How do I build a source package I just downloaded?
- The PackageGuide contains a link of packages along with the description of the package and a tutorial for compiling it.
- I didn't modify any configure.in or makefile.in, but the build process still tries to regenerate these files. What should I do?
C / C++
- How do I create a DLL for Visual Basic to use?
- Where do I find a memory leak detector?
- How do I interrupt a program being debugged by GDB with Ctrl-C?
- I've built an Open Source package, containing documentation in manpage format; how do I read it?
- Manpages are a documentation format prevalent on UNIX systems, where a special program called "man" is normally used to read them.
- There is currently no "man" program available for MinGW/MSYS, although one is under development; (you may download a Development Snapshot, if you are prepared to compile it yourself; see the release notes for further information). In the meantime, you can use the "groff" program, available in this mingwPORT, to read manpages. This program is actually used by the "man" program itself, running a command similar to:--
groff -Tascii -pet -mandoc -P-c <manpage-file> | less -irs
To make it more convenient to view manpages, Wu Yongwei has provided these scripts, which implement a rudimentary version of a "man" program, for use with MSYS, or in a cmd.exe window.
Note that you will still need to have "groff" installed, when the full "man" package becomes available, if you wish to use "man" for reading documentation in the manpage format.
- A man page program for Windows and DOS systems is available from http://sourceforge.net/projects/ezwinports/files/
- A man page program based on http://elks.cvs.sourceforge.net/viewvc/elks/elkscmd/sys_utils/man.c?view=log has been ported to MinGW. It will run natively outside of msys or will work in msys. It's been developed as part of the applications that can built with the LM BLD project.
- Another possible option to look into is using StarDict to view manpages. I've used the program to do so on Linux. It might be worth investigating whether there is a way to turn this plugin option on in the Windows port. The stardict-man-plugin should be the piece needed to get manpages displaying. The source for the Windows version appears to have been built with Microsoft Visual Studio not MinGW. Attempting to compile and build with MinGW (and using msys), I needed to patch some things just to get it to compile and build successfully and am still trying to resolve some issues with plugin libraries. If anyone's interested in investigating further, I think this has the potential to make a very nice alternative for reading man pages on Windows.
- One more option that may be useful is mdocml. It's used by BSD systems to replace groff.
- How is MinGW licensed?
- When Colin Peters released the MinGW runtime he placed the source into the PublicDomain. No one owns a copyright (C) to the source because of this. You as a software manufacturer are free to use the MinGW runtime in your proprietary and OpenSource software as you see fit. The only thing you can't do is to claim ownership of the source and use Colin Peters' name, the MinGW name or the name of any of it's contributors in endorsement of any product.
- Please view MinGWLicensing for full details.
- How is MSYS licensed?
- From MSYS_LICENSE.rtf:
You may redistribute MSYS in part or in whole as long as you follow the guidelines of redistribution of each license contained within. To be certain that you are being legally compliant, always distribute the source. Distribution of source is your responsibility should you decide to redistribute MSYS. If you distribute MSYS via a web site then you must put a copy of the source for that version of MSYS on your web site as well. If you distribute MSYS via removable media then you must distribute that version of MSYS source with that same type of removable media.
Binaries created from the use of MSYS and of MinGW are not bound by any license found within this package unless you use a library that is itself covered by the GPL license. If you wish to create proprietary software then don't use libiberty.a or any other GPL licensed library. A library licensed with LGPL (Lesser GPL) may be used by proprietary software without GPL infection as special permission within the LGPL has given you this right.
So essentially unless you end up explicitly linking against msys-1.0.dll, programs built in MSYS shell using MSYS tools are not infected with GPL. Compiling and linking inside MSYS shell or using MSYS tools alone does not automatically link against the dll.
- Please view MSYS_LICENSE.rtf for full license text.
- What Languages Are Supported?
- As of summer 2005, MinGW supports C, C++, ObjC, Fortran 77, Ada and Java. And last, but not least Pascal is available as a contributed package (GPC).
- How do I use MinGW with Cygwin?
- For those who would like to use the Cygwin environment for development, yet generate non-Cygwin-dependant executables, a much easier option to "-mno-cygwin" does exist. Simply install Cygwin and the MinGW distribution in separate directories (i.e. "C:\CYGWIN" and "C:\MINGW"), and make sure that the "/bin" subdirectory beneath your MinGW installation comes before Cygwin's "/bin" subdirectory in your PATH environment variable (i.e. "PATH=%PATH%;C:\MINGW\BIN;C:\CYGWIN\BIN"). This will allow you access to all the UNIX tools you want, while ensuring that the instance of GCC used is the MinGW version. %%%
- Bear in mind that within the "/etc/profile" file, Cygwin by default places "/usr/local/bin", "/usr/bin", and "/bin" ahead of your system-level PATH. Therefore, it is not enough to have the MinGW's "/bin" ahead of Cygwin in your Windows path... it must also be set to come first within the Cygwin environment (either by modifying "/etc/profile" or setting it manually).
- Is support provided for COM?
- 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 MinGW mailing list archives for more details on COM and more links to example files.
- What's the difference between gcc and mingw32-gcc?
- The mingw32-gcc, mingw32-g++, etc. binaries exist as an aid to cross development. They are created in a typical build of gcc. They are therefore distributed as the maintainers of GCC meant them to be. The gcc.exe indicates that the binary produces binaries for a target equal to the build, while the mingw32-gcc binary produces binaries to be executed on the mingw32 target.
- What's the difference between make and mingw32-make?
- The "native" (i.e.: MSVCRT dependent) port of make is lacking in some functionality and has modified functionality due to the lack of POSIX on Win32. There also exists a version of make in the MSYS distribution that is dependent on the MSYS runtime. This port operates more as make was intended to operate and gives less headaches during execution. Based on this, the MinGW developers/maintainers/packagers decided it would be best to rename the native version so that both the "native" version and the MSYS version could be present at the same time without file name collision.
- How can an MSVC program call a MinGW DLL, and vice versa?
- There exists two methods, both described in MSVC_and_MinGW_DLLs.
- How can a JNI DLL be created?
- A tutorial to create a Java Native Interface DLL can be found here: JNI-MinGW-DLL
- Why do I need mingwm10.dll when I distribute my program and can I get rid of it?
- The mingwm10.dll handles memory allocation/dellocation used with exception handling in a threaded environment. If you do not need threads in your application (-mthreads is not used as a compiler switch), you will not have mingwm10.dll added. See http://old.nabble.com/mingwm10.dll-ts8920679.html for details.
- Do I need to use rxvt?
- No. You can use another console program instead of rxvt. If you're using a version of MSYS after version 1.0.10, there's a --norxvt switch in msys.bat to use the standard Windows console instead. You can customize the Windows console, changing font type, font size, screen colors, buffer size, cut and paste and other features using the Properties tab. You could also run an Open Source program such as Console 2 available at Sourceforge.
- My programs don't print output; how do I fix this?
- This is a long standing issue. If your program is not printing to the screen within MSYS, you can try running MSYS with the standard Windows console instead of with rxvt. You'll want a copy of MSYS after version 1.0.10. Add --norxvt to a shortcut that runs msys.bat. This will allow you to run MSYS in a standard Windows console. If your problem is with stdio when using rxvt, you should be able to invoke your programs and see output to the screen while in this mode.
- How do I pass switches with forward slashes to programs under MSYS?
- Please view page Posix path conversion. You can try using a slash as an escape operator. Anywhere a slash would normally appear, try substituting two slashs.
- How do I build an MSYS binary?
- You must be under a MSYS shell and tools environment to compile. Please refer to MSYS dependent for more information.
- Why will the MSYS shell not open on Windows XP Professional x64?
- Follow the instructions on MsysShell page
- How do I create Python extensions?
- As of Python 2.5, the official distribution is built with MS-VC 2003. Python requires that all extensions be built with the same compiler. It is however possible to build such extensions using MinGW with the help of MSYS. Create a file called pydistutils.cfg in your home directory with the following contents.
- Next, use pexports to export the python dll symbols. The library can typically be found under C:\WINDOWS\system32. Use the following command.
pexports /c/WINDOWS/system32/python25.dll >py25.def
- Then, use the following command to build an import library.
dlltool -D python25.dll -d python25.def -l libpython25.a
- Move libpython25.a to /mingw/lib. You may need to add -I"/path/to/python/include" to the gcc command line. You can now build and install the extensions by following standard UNIX instructions under MSYS.
- How do I execute configure scripts?
- Applications using a UNIX-style build process will typically require a shell environment and set of POSIX tools, for executing configure scripts and building the application. The Cygwin environment was once the only choice available to fill this role, although now the MSYS environment offers MinGW developers a more lightweight alternative. The use of both these environments with MinGW is described in MsysShell and MinGWShell. [FIXME] - This is confusing and doesn't describe the question. __EarnieBoyd__ __2006-04-19__
- What is a Makefile and how do I create one?
- A Makefile can be thought of as a script that is processed by a "make" program. It allows large projects with many source files to compile in an automated way, as opposed to needing to compile each file by manually calling the compiler. It also allows for depedency checking, recompiling only modified files by checking timestamps.
- How do I get pkg-config installed?
- The difficulty in getting pkg-config installed is due its circular depency on glib. To install pkg-config, you should first install the GTK-runtime, the installer is found at http://sourceforge.net/project/showfiles.php?group_id=121075. The pkg-config binary can be obtained from http://www.gtk.org/download-windows.html. Place pkg-config.exe in your MinGW bin directory.
- There are other pkg-config projects that don't have the circular dependency issue. They include:
- Why doesn't %ll work with printf? How do I print a long long value?
- You should use %I64 instead of %ll when using msvcrt.
- Why can't I print a long double using printf using %Lf?
- How do I use Windows sockets, rather than Unix sockets?
- How do I ConvertVisualStudioWorkspace and projects?
- Why can I read/write text files but not binary files?
- Under DOS/Windows, a file can be opened in either text or binary mode. It seems that the default is text mode. To force using binary mode, you have to pass the O_BINARY flag to open(fd, flags)
- See http://cygwin.com/faq.html under "How is the DOS/Unix CR/LF thing handled?" topic for some info.
- How do I convert build commands for the MS resource compiler into windres commands?
- gcc supports C99; why is this support not completely implemented in MinGW?
- What libraries and tools should I install to help when porting and building Open Source applications on MinGW with msys?
- There's information on some of the standard GNU libraries and tools on the Other Libraries and Tools to use with MinGW page. There's also information on other libraries that can help bridge the gap when porting applications from POSIX systems or trying to build Open Source applications.