How to setup a Microsoft Windows programming environment under FreeBSD

Before you start installing anything, you might want to consider creating a separate user account for Windows development, using the "man adduser" command.

First you need to install the Windows emulator called wine:

cd /usr/ports/emulators/wine
make all install clean

Then fetch the latest QT 4.x opensource-mingw version from: Store the file, for example "qt-win-opensource-4.2.0-mingw.exe" in a local folder. Then execute the following command:

wine qt-win-opensource-4.2.0-mingw.exe

When you get to the MinGW installation window select Download and install minimal MinGW installation, if you have not installed it previously. This assumes that you have got a network connection. Else you can pre-fetch and install the the MinGW-X.X.X.exe from

Before you will be able to compile anything you need to setup the PATH environment for MinGW and QT 4.X. Basically what you want is to have "PATH=c:\mingw\bin;c:\qt\4.0.2\bin". Note that this is just an example. The directories must match where you installed MinGW and QT 4.x.

wine regedit.exe

Lookup the "PATH" environment variable, and append for example: ";c:\mingw\bin;c:\qt\4.0.2\bin".

That is it. Now test that the PATH environment is activated:

wine g++ --help

The only thing that doesn't work yet is to run the QT applications you compile under Wine. But that might change with the next release of Wine.

Good luck.