Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QApplication: No such file or directory
Forum Updated to NodeBB v4.3 + New Features

QApplication: No such file or directory

Scheduled Pinned Locked Moved General and Desktop
12 Posts 5 Posters 8.7k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DeanQt
    wrote on last edited by
    #1

    This has been asked numerous times on this and other forums and I even had this error before and it used to be resolved using said recommendations but this time no proposed solutions work.

    Basically the above title is the error I get and my .pro file is:

    @TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt

    SOURCES += main.cpp
    finddialog.cpp

    HEADERS +=
    finddialog.h
    @

    I tried adding the following with no avail:

    @QT += widgets
    QT += gui@

    Pleaas note, source code is flawless as it comes out of C++ GUI Programming with Qt 4 one of the beginning examples.

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      Don't forget to run qmake after you add Qt += widgets in the .pro file and only after that you can build the project.

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        Try including <QtWidgets/QApplication> if the hint from Zlatomir does not work.

        (Z(:^

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DeanQt
          wrote on last edited by
          #4

          Im not sure how to run a make file. I see numerous references oin the net and in the textbookIm using but not a step by step process on how to execute it?

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            If you are using Qt Creator, just go to "Build" and select "Rebuild All".

            If you are on terminal, best clean the build dir, then run:
            @
            qmake
            make
            @

            (Z(:^

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DeanQt
              wrote on last edited by
              #6

              Same error persists. "No such file or directory"

              1 Reply Last reply
              0
              • ZlatomirZ Offline
                ZlatomirZ Offline
                Zlatomir
                wrote on last edited by
                #7

                Are you using Qt Creator ide? If so make sure you added QT += widgets in your .pro file, than click run qmake (from the Build menu) and than build.

                https://forum.qt.io/category/41/romanian

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi,

                  In your pro file you have

                  @CONFIG -= qt@

                  that removes completely Qt from your project, just remove that line and run qmake again (depending on your Qt version you might need to add QT += widgets)

                  Hope it helps

                  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
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    [quote author="SGaist" date="1364159071"]Hi,

                    In your pro file you have

                    @CONFIG -= qt@ [/quote]

                    Hahaha! Amazing how nobody noticed that before! :D Nice catch, SGaist!

                    (Z(:^

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Beberd
                      wrote on last edited by
                      #10

                      In QT 4.8.0, you need to include #include <QtGui/QApplication> for 5.0.1 you need to include <QtWidgets/QApplication>

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DeanQt
                        wrote on last edited by
                        #11

                        Hi guys

                        Solved:

                        I included:

                        @
                        QT += widgets
                        CONFIG += qt
                        @ under .pro file

                        Then to recogsnise widgets I used

                        @#include <QtWidgets>@
                        under the file that uses widgets

                        Dont know if this makes sense as to why it works but it works...

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          CONFIG contains qt by default, so no need to add it, just remove the "CONFIG -= qt" line from your pro file.

                          Including "QtWidgets" includes in fact All headers related to the QtWidget module, that's why it works. It's cleaner to only include what you currently uses i.e <QLineEdit> or if you want a clearer separation of modules in your include part <QtWidgets/QLineEdit>.

                          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
                          0

                          • Login

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