Cross-compiling from MinGW to Fedora 12 on Windows - console window?

After reading this article http://lukast.mediablog.sk/log/?p=155 I decided to use mingw for linux to compile Windows applications. This means that I can compile, test, debug and release directly from Linux.

I hacked this assembly script, which will block the compilation of the application and even pack it into a ZIP file. Note that I use the source builds for QMake (did you even know that this is supported? Wow ...). Also note that the script will automatically pull out the necessary DLLs. Here is a script for all of you to use and abuse:

#! /bin/sh set -x set -e VERSION=0.1 PRO_FILE=blabla.pro BUILD_DIR=mingw_build DIST_DIR=blabla-$VERSION-win32 # clean up old shite rm -fr $BUILD_DIR mkdir $BUILD_DIR cd $BUILD_DIR # start building QMAKESPEC=fedora-win32-cross qmake-qt4 QT_LIBINFIX=4 config=\"release\ quiet\" ../$PRO_FILE #qmake-qt4 -spec fedora-win32-cross make DLLS=`i686-pc-mingw32-objdump -p release/*.exe | grep dll | awk '{print $3}'` for i in $DLLS mingwm10.dll ; do f=/usr/i686-pc-mingw32/sys-root/mingw/bin/$i if [ ! -f $f ]; then continue; fi cp -av $f release done mkdir -p $DIST_DIR mv release/*.exe $DIST_DIR mv release/*.dll $DIST_DIR zip -r ../$DIST_DIR.zip $DIST_DIR 

Compiled binary work on the Windows7 machine under test. Now to the questions:

  • When I run the application on Windows, the theme is not a Windows7 theme. I assume that I don't have a style module, I'm not sure yet.
  • For some reason, the application gets a console window.

The second point (console window) is critical. How to remove this background window? Please note that extra configuration lines do not work for me, what am I missing there?

Change 1 (plan a few):

Compilation Line:

 i686-pc-mingw32-g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -o release/font_export.exe object_script.font_export.Release -L"/usr/i686-pc-mingw32/sys-root/mingw/lib" -lQtGui4 -lQtCore4 

The switch -subsystem,windows added only with "CONFIG + = windows", and this is ignored on other operating systems. I assume the QG MinGW port is getting confused "I work on Linux, I need to ignore the windows / console configuration." This means that I need to edit the corresponding qmake.spec file. arhg ... I hate mistakes. I still need to verify that this fixes the problem ....

+4
source share
2 answers

I suspect your theme issue is the result of a lack of application manifest

The reason your application receives the console is simple. Windows applications come in two flavors: a console and a graphical interface. The difference is a bit in the PE header of the EXE. By default, GCC should create a console application, and e8johan explains how to change this (-Wl, -subsystem, windows). In addition, some of them cheat entry point (graphical user interface, is expected to use the WinMain() and console applications main() ), but the MinGW should take care of it

+3
source

You may be able to remove it by including -Wl,-subsystem,windows . This article shows how, but you want to replace -mwindows with -Wl,-subsystem,windows to avoid using the deprecated gcc function.

+2
source

Source: https://habr.com/ru/post/1306583/


All Articles