how to

HOWTO Specify the Header File Include Path for use with MinGW Compilers

FIXME: Page under construction; some useful content now, but by no means complete!!!

I will add to this as time permits; please bear with me. My intent is to provide answers to some remarkably similar, but independently asked, questions which have appeared recently, on the MinGW-Users and MinGW-MSYS lists.


Introduction

This Mini-HOWTO attempts to answer the FAQ: "Why can't the MinGW compilers find my project's header files?"

Build a MinGW hosted cross compiler

TODO: Formatting

!! Building a mingw hosted cross compiler

To compile and link executables for an embedded target under windows you require a cross compiler for your required processor. This is almost as easy with a properly configured msys/mingw installation as it is with a linux machine, merely requiring a few patches for some things that aren't available in a windows native environment.

Large executables

TODO: Reformat to MediaWiki formatting.

!!!Minimalist GNU for Windows

!!Reasons for 'large' objects, libraries and executables

!Debugging Information

The most common reason why executables are larger than expected is that they include debugging information, which is generated when source files are compiled with the "-g" option to GCC. Even when your own source files are compiled without debugging information, libraries linked with your executable may have been compiled with "-g" (possibly including system libraries that are distributed with MinGW).

Use more recent defined functions

  • When compiling, the compiler doesn't seem to find the correct definitions for a specific Windows version or a specific Internet Explorer version. Why is that?
    • You need to set defines _WIN32_WINDOWS, _WIN32_WINNT, WINVER and/or _WIN32_IE to the minimum platform you plan to support before including the windows.h header file. Possible values for these definitions can be found in the header w32api.h file.

Compile with gcj

When you first download and install the MinGW Java compiler (gcc-java), you may find that when you try to compile a Java program with gcj, you get an error saying "cannot find -liconv". This is because gcj automatically attempts to link your program with libiconv, which is not distributed with MinGW and must be downloaded and installed separately. To get your Java program to compile, download libiconv from http://gnuwin32.sourceforge.net/packages/libiconv.htm. You want "Binaries" and "Developer files". Unzip both downloaded files to your MinGW directory.

MinGW cross compiler for Linux build environment

Page updated to current status, as of 15-September-2008.

Previous content of this page was confused, misleading and obsolete. Nevertheless, if you wish to refer to this older content, you may find it here.

HOWTO Submit Patches to Correct MinGW Bugs or to Add MinGW Features

You've identified a bug in a MinGW package, and you've developed a solution to correct the defect. So, how do you submit that solution, for inclusion in MinGW?

All user proposed modifications or enhancements to MinGW are subject to review and approval by the project administrators, and the project development team. By following the guidelines set out below, you will give your solution its best chance of being adopted, in a timely fashion.

HOWTO Compile with gcj

TODO: Convert to the MediaWiki formatting as discussed at Converting Old MinGWiki Pages

HOWTO Use the GCC specs file

About Specs file

The "gcc" program invoked by users is a convenient front-end driver executable which will invoke other programs in the background such as cc1, as or ld to do its work according to the command line parameter given. A specs file is plain text used to control the default behavior for the "gcc" front-end. The specs file is usually built-in but for flexibility purposes, it can be overridden with an external version.

Converting Old MinGWiki Pages

Reference 1: http://www.mingw.org/MinGWiki/index.php/TextFormattingRules Reference 2: http://www.mediawiki.org/wiki/Help:Formatting

Copying and Pasting from old to new

  • Goto an existing old MinGWiki page
  • execute the login function
  • click the edit button
  • click the mouse into the edit box
  • press the Ctrl-A keyboard action to select all text in the input form
  • Now Create content and choose New MinGWiki.
  • If not already provided, enter the title from the old MinGWiki page