Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QMake doesn't work properly
QtWS25 Last Chance

QMake doesn't work properly

Scheduled Pinned Locked Moved Solved Installation and Deployment
qmakemakemakefile
18 Posts 6 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johnnyk91
    wrote on 12 Oct 2020, 13:52 last edited by
    #1

    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

    J 1 Reply Last reply 12 Oct 2020, 13:58
    0
    • J Offline
      J Offline
      Johnnyk91
      wrote on 13 Oct 2020, 10:43 last edited by
      #17

      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

      1 Reply Last reply
      3
      • J Johnnyk91
        12 Oct 2020, 13:52

        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

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 12 Oct 2020, 13:58 last edited by
        #2

        @Johnnyk91 Is libqt5widgets5 package also installed?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        J 1 Reply Last reply 12 Oct 2020, 17:53
        1
        • J jsulm
          12 Oct 2020, 13:58

          @Johnnyk91 Is libqt5widgets5 package also installed?

          J Offline
          J Offline
          Johnnyk91
          wrote on 12 Oct 2020, 17:53 last edited by Johnnyk91 10 Dec 2020, 17:54
          #3

          @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...

          K 1 Reply Last reply 12 Oct 2020, 18:43
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 12 Oct 2020, 17:56 last edited by
            #4

            Hi,

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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            J 1 Reply Last reply 12 Oct 2020, 18:15
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 12 Oct 2020, 18:00 last edited by
              #5

              --> qmake -v to get the qmake version

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

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • S SGaist
                12 Oct 2020, 17:56

                Hi,

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

                J Offline
                J Offline
                Johnnyk91
                wrote on 12 Oct 2020, 18:15 last edited by Johnnyk91 10 Dec 2020, 18:21
                #6

                @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'
                
                C 1 Reply Last reply 12 Oct 2020, 18:28
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 12 Oct 2020, 18:25 last edited by
                  #7

                  That looks good.

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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  J 1 Reply Last reply 12 Oct 2020, 18:27
                  0
                  • S SGaist
                    12 Oct 2020, 18:25

                    That looks good.

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

                    J Offline
                    J Offline
                    Johnnyk91
                    wrote on 12 Oct 2020, 18:27 last edited by
                    #8

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

                    1 Reply Last reply
                    0
                    • J Johnnyk91
                      12 Oct 2020, 18:15

                      @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'
                      
                      C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 12 Oct 2020, 18:28 last edited by
                      #9

                      @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???

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      J 1 Reply Last reply 12 Oct 2020, 18:37
                      1
                      • C Christian Ehrlicher
                        12 Oct 2020, 18:28

                        @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???

                        J Offline
                        J Offline
                        Johnnyk91
                        wrote on 12 Oct 2020, 18:37 last edited by
                        #10

                        @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

                        1 Reply Last reply
                        0
                        • J Johnnyk91
                          12 Oct 2020, 17:53

                          @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...

                          K Offline
                          K Offline
                          kshegunov
                          Moderators
                          wrote on 12 Oct 2020, 18:43 last edited by
                          #11

                          @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.

                          Read and abide by the Qt Code of Conduct

                          J 2 Replies Last reply 12 Oct 2020, 19:05
                          0
                          • K kshegunov
                            12 Oct 2020, 18:43

                            @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.

                            J Offline
                            J Offline
                            Johnnyk91
                            wrote on 12 Oct 2020, 19:05 last edited by
                            #12

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

                            1 Reply Last reply
                            0
                            • K kshegunov
                              12 Oct 2020, 18:43

                              @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.

                              J Offline
                              J Offline
                              Johnnyk91
                              wrote on 13 Oct 2020, 02:15 last edited by
                              #13

                              @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
                              
                              
                              JKSHJ 1 Reply Last reply 13 Oct 2020, 02:23
                              0
                              • J Johnnyk91
                                13 Oct 2020, 02:15

                                @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
                                
                                
                                JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on 13 Oct 2020, 02:23 last edited by
                                #14

                                @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.

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                J 1 Reply Last reply 13 Oct 2020, 02:46
                                1
                                • JKSHJ JKSH
                                  13 Oct 2020, 02:23

                                  @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.

                                  J Offline
                                  J Offline
                                  Johnnyk91
                                  wrote on 13 Oct 2020, 02:46 last edited by
                                  #15

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

                                  JKSHJ 1 Reply Last reply 13 Oct 2020, 03:57
                                  0
                                  • J Johnnyk91
                                    13 Oct 2020, 02:46

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

                                    JKSHJ Offline
                                    JKSHJ Offline
                                    JKSH
                                    Moderators
                                    wrote on 13 Oct 2020, 03:57 last edited by JKSH
                                    #16

                                    @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.

                                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                    1 Reply Last reply
                                    1
                                    • J Offline
                                      J Offline
                                      Johnnyk91
                                      wrote on 13 Oct 2020, 10:43 last edited by
                                      #17

                                      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

                                      1 Reply Last reply
                                      3
                                      • S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on 13 Oct 2020, 18:49 last edited by
                                        #18

                                        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.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        5

                                        1/18

                                        12 Oct 2020, 13:52

                                        • Login

                                        • Login or register to search.
                                        1 out of 18
                                        • First post
                                          1/18
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved