Important: Please read the Qt Code of Conduct -

QtWidget app doesn't build as executable

  • Hey!
    First I'm on linux ubuntu 18.04, using Qt 5.11.1 with QtCreator 4.7.2
    I've got a probleme with a Qt app, it builds well and exeucute well but when I double click
    on it in the file manager, iit opens the file as a text file.

    It seems like the app has been build as a library.

    Thanks for your help.

  • Lifetime Qt Champion

    Hi and welcome to the forums.
    Well if it can executes, it cant be a library ?
    Try navigation to the build folder with a shell and start it from there and see what happens.

    Also, check the pro file
    TEMPLATE = app

  • Hey, yes it runs well in terminal with ./MyApp and here is my full .pro file :

  • Lifetime Qt Champion

    Should be an app then . seems your OS opens an executable in
    text editor then. I have seen this with .sh scripts but not
    binary "exe" files. But Qt/app is fine. Its an OS thing.

  • Ok, I've got new data :

    First, I tested the application on a brand new linux laptop and it does have the same problem.
    So it's either a problem with ubuntu or a problem with Qt (lets talk seriously, the second one is the most likely).

    Second, I created a new Qt widget project with the QtCreator template project of the same name.
    and it has the same problem.

    Then I reinstalled completely Qt and retried everything, and same problem.

    Finally I renamed the file with an .appimage at the end, and the problem just disappear, it show the binary icon in the file manager, and when we double click on it, it opens fine!!!

    So, seems it a problem with linux.


    If you are in the same situation, just rename your executable with an .appimage at the end.

Log in to reply