Important: Please read the Qt Code of Conduct -

How to embed executable into app

  • Hi;
    What's the problem:
    My Qt Quick application runs external *.exe (using QProcess) and communicate with it.
    It works when I put direct path to exec file and compile for desktop.

            const QString EXEC_PATH = "c:/Users/zby/Desktop/quick/testApp/Exec/Gomoku.exe";
            m_pGomokuProcess->start( EXEC_PATH, ARG_LIST_DEFAULT_O );

    The problem is when I run app on mobile phone..
    Gomoku.exe is just unavaliable and when process runs thorw a exception: Gomoku process has failed.

    What's I have tried to do:
    Somehow emmbed exec into application while compile.
    a. I added Gomoku.exe to resources (.qrc):
    b. I invoked exec like this:

    const QString GomokuExe::EXEC_PATH = ":/Algorithm/Exec/Gomoku.exe";        
            m_pGomokuProcess->start( EXEC_PATH, ARG_LIST_DEFAULT_O );

    but got: Gomoku process has failed.

    Is it a way to emmbedd exec into app?

  • Lifetime Qt Champion


    You can't run them from a .qrc file. QProcess uses the platform infrastructure to run the executable/scripts/etc. passed in parameter. These infrastructures just don't know how to go read an executable from qrc. What you can do is copy your executable from the resource to a known folder location on the target.

    One last detail: Gomoku.exe look like a Windows application, don't forget to build it also for the the other platform you are targetting.

  • Yes, Gomoku.exe - was targetted for my PC windows and was unaware that it won't work on android.
    So what I have to do is:

    • copile Gomoku project with 'Android for armeabi-v7a' - but what would be the output? Binary file or .exe?

    • Even though I would be able to re - targeted my entire Gomoku project to 'Android for armeabi-v7a' (hope it will be easy as I use CMake ) is there an option to put it everything into one bundle (maybe modifying AndroidManifest.xml) and deploy app at one time instead of copying .exe then load application separatly?

  • Lifetime Qt Champion

    Android is a Linux based OS that is usually running on ARM based devices so no you can't run Windows executable on that OS.

    It's a bit more complexe than exec vs binary. I'm not even sure whether your package would pass the PlayStore verification if embedding several executables. In any case, a Qt application on Android is not an exe file.

Log in to reply