Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Set up Qtcreator for cross-compiling Linux host to Windows 10 and 11 targets
Forum Updated to NodeBB v4.3 + New Features

Set up Qtcreator for cross-compiling Linux host to Windows 10 and 11 targets

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 90 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    montanaviking
    wrote last edited by
    #1

    Hi,
    I am trying to set up Qtcreator to facilitate Windows development using a Linux, i.e. Ubuntu 22.04 or Ubuntu 24.04 host. I do have Qt6 development environment (Qtcreator etc...) set up and working on my Windows 10 target, but the compilation and linking steps are painfully slow on Windows and I think (from past experience) would be much faster on Linux due to Linux's faster file IO (as I am told).
    I have tried downloading the Qt 6.9 source code and have installed mingw-w64 cross-compiler for Win32 Win64.
    I followed the procedure of:
    https://medium.com/@vladadgad/cross-compile-qt-for-windows-on-linux-platform-57e4b71ed1aa
    However, I get the following fatal error:

    Building CXX object CMakeFiles/cmTC_5bc10.dir/src.cxx.o
    /usr/bin/c++ -DHAVE_ntddmodm -fPIE -std=gnu++17 -o CMakeFiles/cmTC_5bc10.dir/src.cxx.o -c /opt/Qtsource/qt5/CMakeFiles/CMakeTmp/src.cxx
    /opt/Qtsource/qt5/CMakeFiles/CMakeTmp/src.cxx:2:10: fatal error: windows.h: No such file or directory
    2 | #include <windows.h>
    | ^~~~~~~~~~~
    compilation terminated.

    It appears that the cross-compiler cannot find windows.h but locate finds it in:
    /usr/share/mingw-w64/include/windows.h
    Any ideas welcome and thanks,
    Phil

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote last edited by
      #2

      /usr/bin/c++ is the local compiler on Linux, not the cross-compiler, which on my system is x86_64-w64-mingw32-g++.
      That means, something in the configure step went wrong or the toolchain hasn't been installed correctly.
      See here for more info: https://doc.qt.io/qtvstools/qtvstools-how-to-cross-compile.html

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved