Falko Schindler

A Computer Vision Scientist from Bonn, Germany

Cross-compiling with Ubuntu and MinGW

2010-08-30 by Falko Schindler, tagged as tools

MinGW is a “Minimalist GNU compiler for Windows”. I needed it for a Windows-program I am currently working on.

After struggling with setting up my familiar Vim environment in Windows running within a Virtual Box, I realized that I can use a Linux system for the development as well. And best of all, the setup is done in the blink of an eye!

After installing MinGW with sudo aptitude install mingw32 you just need to adjust your Makefile a little, e. g. like:

CXX = i586-mingw32msvc-g++
CXXFLAGS = -Wall -O3
all : main.exe
main.exe : main.o
    $(CXX) $(LDFLAGS) -o main.exe main.o
clean :
    rm *.o *.exe

Now the make command builds the win32 executable. You can easily run it with Wine: wine main.exe.