title: How to cross-compile with MinGW on Linux for Windows?
body: <p>I'm trying to compile a Qt5 application for Windows on Linux with MinGW.</p>
  
  <p>I'm using Travis-CI to get continuous builds of two windows executables (win32, win64). </p>
  
  <p>I've set up a build matrix, which contains the definition of the different MinGW dependencies. The <code>before-install</code> section defines the Qt, MinGW and gcc dependencies. The packages are fetched during <code>install</code>.</p>
  
  <p>This is my <code>.travis.yml</code>:</p>
  
  <pre><code>language: cpp   
    matrix:
  fast_finish: true
  include:
    # cross-compile using mingw
    - compiler: ": w64"
      env: PLATFORM="mingw32" ARCH="x86_64" BITSIZE=64 HOST="x86_64"
    - compiler: ": w32"
      env: PLATFORM="mingw32" ARCH="x86" BITSIZE=32 HOST="i686"
  
  install:
    - sudo add-apt-repository --yes ppa:beineri/opt-qt54                   # &lt; Qt
    - sudo add-apt-repository --yes ppa:tobydox/mingw-x-precise            # &lt; MinGW
    - sudo apt-get update -qq
    - uname -m
    - sudo apt-get install qt54base qt54imageformats qt54tools -y -qq
    - export QTDIR=/opt/qt54
    - export PATH=$QTDIR/bin:$PATH
    - export LD_LIBRARY_PATH=$QTDIR/lib/:$QTDIR/lib/`uname -m`-linux-gnu:$LD_LIBRARY_PATH
    - sudo apt-get install -y cloog-isl mingw32
    - if [ $BITSIZE == 32 ]; then sudo apt-get install -y mingw32-x-binutils mingw32-x-gcc mingw32-x-runtime; fi
    - if [ $BITSIZE == 64 ]; then sudo apt-get install -y mingw64-x-binutils mingw64-x-gcc mingw64-x-runtime; fi
    - export MINGW=/opt/mingw$BITSIZE
    - export PATH=$MINGW/bin:$PATH
    - export CC=$HOST-w64-mingw32-gcc
    - export CXX=$HOST-w64-mingw32-g++
  
  script:
    - qmake -v
    - qmake wpnxm-servercontrolpanel.pro CONFIG+=release QMAKE_CC=$CC QMAKE_CXX=$CXX
    - gcc -v
    - gcc -dumpmachine
    - export CMAKE_OPTS="-DUSE_WERROR=ON"
    - make -j2 VERBOSE=1
  </code></pre>
  
  <p>The build fails.</p>
  
  <p>The output of <code>make</code> contains</p>
  
  <pre><code> i686-w64-mingw32-g++ -c -pipe -O2 -std=c++0x -D_REENTRANT -Wall -W -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/opt/qt54/mkspecs/linux-g++ -I. -I/opt/qt54/include -I/opt/qt54/include/QtWidgets -I/opt/qt54/include/QtGui -I/opt/qt54/include/QtNetwork -I/opt/qt54/include/QtCore -I. -I. -o mainwindow.o src/mainwindow.cpp
  src/mainwindow.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
   /*
   ^
  src/mainwindow.cpp:41:21: fatal error: QCheckbox: No such file or directory
   #include &lt;QCheckbox&gt;
                       ^
  compilation terminated.
  </code></pre>
  
  <p>Found out: it's QCheck<strong>B</strong>ox.</p>
  
  <p>I'm not sure, if i fetch the right version of Qt5.</p>
  
  <p>Which changes are needed to build the executables?</p>