[Solved] Biologist using a Qt built program - how can I run it??



  • I am a biologist (not a computer scientist!!) trying to use a program that is written in C++ and needs Qt for building. I would very much appreciate any help getting this work - below I describe what I've done so far, and my problems.

    Firstly I installed Qt 5.5 for windows, opensource, downloaded from the website.
    I then downloaded the files for the program I need from GitHub.
    Next I opened these projects using Qt Creator.
    Running the "start debugging" (F5) option yielded a couple of issues - some missing data files which I had to add the correct directory, and it didn't seem to like the "toAscii" function in the code, so I changed all instances to "toLatin1".
    Now it debugs without errors. So far so good. Now I want to use the program.

    First I run "qmake" which runs without errors and then click on "Build Project" which also runs without errors. Using the Run function from Qt creator, I then get a cmd window which details all the options for the program I'm trying to run. So can I run my program this way, via Qt creator? That would be fine for me. However, it looks like I can't.
    The trouble is, at the bottom of this list of program options in the cmd window is the following: "Press <RETURN> to close this window>". Thus if I try to enter an argument / option / input file for the program to work with and then press enter, the window closes.

    Well, maybe this isn't the way to do it, perhaps I need to generate an executable for the program, to be run independently from Qt. First it seems I need to make a static version of Qt, whatever that is. Of course, when I try the instructions here: http://doc.qt.io/qt-5/windows-deployment.html they don't work. Configure isn't recognized as an internal or external command. Finally I find the configure.bat file and run that from this directory. Somewhere I read that Qt requires Perl, so I download it and add it to my PATH. I run configure.bat -platform win32-g++ -static, choose the open source option, accept the licence, but then get the following: "execute: File or path is not found: <mingw32-make>". I naively assumed that mingw32 would be there somewhere since MinGW 4.9.2 is definitely part of the Qt5.5 installation package that I downloaded. However, elsewhere in help forums it is suggested that I need to install MinGW separately. And this is only the first step in creating the stand alone application....

    So I begin to ask myself, is all this really necessary? Am I on the right track, or is there an easier way? I just want to run the program...

    Any help would be greatly appreciated!
    Alastair


  • Moderators

    Hi Alastair, and welcome to the Qt Dev Net!

    I then get a cmd window which details all the options for the program I'm trying to run. So can I run my program this way, via Qt creator? That would be fine for me. However, it looks like I can't.
    The trouble is, at the bottom of this list of program options in the cmd window is the following: "Press <RETURN> to close this window>". Thus if I try to enter an argument / option / input file for the program to work with and then press enter, the window closes.

    You need to provide the arguments before the program starts running. Once you're presented with the list of options, it's too late to provide those arguments.

    Usually, people use a console, a.k.a. "command line", to launch the program. However, you can also do this easily in Qt Creator:

    1. In Qt Creator, open your project.
    2. Click "Projects" (on the left)
    3. Click "Run" (top-left, to the right of "Manage Kits...")
    4. In the middle of the Run Settings page, look for "Arguments"
    5. Enter your arguments/options there
    6. Run your program (click the green triangle on the bottom-left, or press Ctrl+R)

    Note: When you Debug, the program will probably run very slowly. To get proper perfoemance, make sure you do the following:

    • Build your program in Release mode (Click the computer icon on the bottom-left, and change from "Debug" to "Release")
    • Do not use "start debugging" (F5). Instead, Run your program normally (Ctrl+R)

    Good luck!



  • @Skeffington There is no need to built it statically just get the required DLLs from the Qt installation directory Qt\5.5\mingw492_32\bin and copy them next to your executable then you can start your program without using QtCreator (well you'll have to use it at least once to build the program but it seems you already did that).


  • Qt Champions 2016

    hi and welcome
    If you can build it, then you will have a .exe in your build folder. Look in Project tab (to left in Creator) and
    see where it is.
    To run that exe outside Creator, you need to copy some dlls to the folder and
    maybe also create a subfolder and put some dlls there.

    you can move the exe to any folder and add the dlls there.
    often the following dlls are needed
    icudt51.dll
    icuin51.dll
    icuuc51.dll
    libEGL.dll
    libGLESv2.dll
    Qt5Core.dll
    Qt5Gui.dll
    Qt5Widgets.dll

    What it seems you have been reading is how to static link the dlls. which means put them all inside the program.
    You dont need that to run program.
    If you go to the build folder and click on the exe it will complain about dlls missing. find it and copy there.
    you can also use a tool. see here
    http://stackoverflow.com/questions/17736229/do-i-have-to-include-all-these-qt-dlls-with-my-application

    NOTE: there are release and debug builds. and the DLLS are different. debug has a D to the name.
    so make sure you choose right. if you just open project and build it, its most liekly debug so all dlls should have d in name.
    like Qt5Cored.dll



  • Many thanks for all the advice - JKSH pointed me in the right direction. The other posts will also be very useful for me.
    Cheers,
    Alastair


  • Qt Champions 2016

    @Skeffington
    Cheers :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.