I’m trying to setup a cross-compiler from my Ubuntu laptop so that I can compile command line programs for Windows. I have compiled all libraries I need with g++ until now, so I wanted to do the same in order to produce the equivalent Windows binary.
I have installed gcc-mingw via apt-get, and it installed a number of binaries. I have compiled successfully an “Hello World” program for windows using the i686-w64-mingw32-g++ binary.
However I have some problem during the compilation of my more complex project. I noticed that this binary includes different folders from the standard g++, and it can’t find dependencies (for example, boost headers, bits/predefs.h, etc.). Is there a way to setup mingw parameters so that it works as g++ does out of the box?
I found the problem. The Boost library I was using was one I installed via apt-get. Apparently this meant that many
#if defined (__GLIBC__)were automatically converted in#if 1. This caused the inclusion of some non-cross-platforming header files. Downloading the library from the website and using it solved the problem.