Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMake doesn't work properly



  • HI

    I am on Ubuntu 20.04 LTS and I've just installed Qt through the command :

    sudo apt install qt5-default
    

    but QMake doesn't seem to work properly.

    Even when I add QT += widgets in the project file (.pro), the compilation with Make fails because it can't find QApplication.

    I generated the makefile with the command

    qmake project.pro -o Makefile
    

    and I get a makefile which the variable INCPATH is only set to

    INCPATH       = -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++
    

    Anybody knows how to fix this properly ?

    Cordially



  • I've managed to fix it.

    I set the variable CONFIG to debug in my project file and I think that's why the modules weren't added.
    I took this line off and I was able to compile and run my program.

    Thank you for trying to help me


  • Lifetime Qt Champion

    @Johnnyk91 Is libqt5widgets5 package also installed?



  • @jsulm Hi

    I've just checked with

    sudo dpkg --list
    

    and it is installed.

    I've also found the directory with the Qt Headers QApplication, QObject, etc...


  • Lifetime Qt Champion

    Hi,

    Just an educated guess but check the qmake version. It's possible that you are currently using a Qt 4 qmake.


  • Lifetime Qt Champion

    --> qmake -v to get the qmake version

    and maybe qmake -d <foo>.pro to see what exactly happens.



  • @SGaist By running the command

    qmake -v
    

    I get this

    QMake version 3.1
    Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu
    

    @Christian-Ehrlicher By running the command

    qmake -d <foo>
    

    I get this

    bash: syntax error near unexpected token `newline'
    

  • Lifetime Qt Champion

    That looks good.

    What do you get if you just call "qmake project.pro" without any other parameters ?



  • @SGaist The terminal doesn't display any message.
    The Makefile generated is the same.


  • Lifetime Qt Champion

    @Johnnyk91 said in QMake doesn't work properly:

    qmake -d <foo>

    I get this
    bash: syntax error near unexpected token `newline'

    You did not really put 'qmake -d <foo>' into your command line and wondered that it did not work? Do you???



  • @Christian-Ehrlicher I don't know what you mean but I tried

    qmake -d
    

    and I got a lot of lines starting with DEBUG 1


  • Qt Champions 2017

    @Johnnyk91 said in QMake doesn't work properly:

    and it is installed.
    I've also found the directory with the Qt Headers QApplication, QObject, etc...

    Make sure the development packages are installed, that is qtbase5-dev and qtbase5-dev-tools.



  • @kshegunov Thank you for your suggestion. I turned off my computer. I'll check tomorrow and come back to you.



  • @kshegunov I've just checked and they were already installed.

    All the packages related to qt on my computer are

    ii  libqt5concurrent5:amd64                    5.12.8+dfsg-0ubuntu1                amd64        Qt 5 concurrent module
    ii  libqt5core5a:amd64                         5.12.8+dfsg-0ubuntu1                amd64        Qt 5 core module
    ii  libqt5dbus5:amd64                          5.12.8+dfsg-0ubuntu1                amd64        Qt 5 D-Bus module
    ii  libqt5gui5:amd64                           5.12.8+dfsg-0ubuntu1                amd64        Qt 5 GUI module
    ii  libqt5network5:amd64                       5.12.8+dfsg-0ubuntu1                amd64        Qt 5 network module
    ii  libqt5opengl5:amd64                        5.12.8+dfsg-0ubuntu1                amd64        Qt 5 OpenGL module
    ii  libqt5opengl5-dev:amd64                    5.12.8+dfsg-0ubuntu1                amd64        Qt 5 OpenGL library development files
    ii  libqt5printsupport5:amd64                  5.12.8+dfsg-0ubuntu1                amd64        Qt 5 print support module
    ii  libqt5sql5:amd64                           5.12.8+dfsg-0ubuntu1                amd64        Qt 5 SQL module
    ii  libqt5sql5-sqlite:amd64                    5.12.8+dfsg-0ubuntu1                amd64        Qt 5 SQLite 3 database driver
    ii  libqt5svg5:amd64                           5.12.8-0ubuntu1                     amd64        Qt 5 SVG module
    ii  libqt5test5:amd64                          5.12.8+dfsg-0ubuntu1                amd64        Qt 5 test module
    ii  libqt5widgets5:amd64                       5.12.8+dfsg-0ubuntu1                amd64        Qt 5 widgets module
    ii  libqt5xml5:amd64                           5.12.8+dfsg-0ubuntu1                amd64        Qt 5 XML module
    ii  libqwt-qt5-6                               6.1.4-1.1build1                     amd64        Qt widgets library for technical applications (runtime, qt5)
    ii  qt5-default:amd64                          5.12.8+dfsg-0ubuntu1                amd64        Qt 5 development defaults package
    ii  qt5-gtk-platformtheme:amd64                5.12.8+dfsg-0ubuntu1                amd64        Qt 5 GTK+ 3 platform theme
    ii  qt5-qmake:amd64                            5.12.8+dfsg-0ubuntu1                amd64        Qt 5 qmake Makefile generator tool
    ii  qt5-qmake-bin                              5.12.8+dfsg-0ubuntu1                amd64        Qt 5 qmake Makefile generator tool — binary file
    ii  qtbase5-dev:amd64                          5.12.8+dfsg-0ubuntu1                amd64        Qt 5 base development files
    ii  qtbase5-dev-tools                          5.12.8+dfsg-0ubuntu1                amd64        Qt 5 base development programs
    ii  qtchooser                                  66-2build1                          amd64        Wrapper to select between Qt development binary versions
    ii  qttranslations5-l10n                       5.12.8-0ubuntu1                     all          translations for Qt 5
    
    

  • Moderators

    @Johnnyk91 said in QMake doesn't work properly:

    All the packages related to qt on my computer are

    You have installed the runtime packages.

    As @kshegunov said, you must also install the development packages.



  • @JKSH Are the development packages qtbase5-dev and qtbase5-dev-tools ?


  • Moderators

    @Johnnyk91 said in QMake doesn't work properly:

    @JKSH Are the development packages qtbase5-dev and qtbase5-dev-tools ?

    Ah, sorry... I just noticed that you do have qtbase5-dev and qtbase5-dev-tools installed. OK, you already have the development packages.

    Next thing to try: Install Qt Creator and see if you can use it to build an application.



  • I've managed to fix it.

    I set the variable CONFIG to debug in my project file and I think that's why the modules weren't added.
    I took this line off and I was able to compile and run my program.

    Thank you for trying to help me


  • Lifetime Qt Champion

    If you did something like

    CONFIG = debug
    

    You, in fact, nuked the content of the variable and replaced it with debug.

    If you want to modify the content of such a variable, use either += or *=. The first to add a value and the second to add the value only if not already in the variable.


Log in to reply