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. Can't import QApplication?

Can't import QApplication?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 411 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.
  • M Offline
    M Offline
    Miixtar
    wrote on last edited by
    #1

    Heyya!

    I was just kicking of a new project so started by writing the usual basic code, nothing fancy:

    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        return app.exec();
    }
    
    

    And I get an error telling me " 'QApplication' file not found ". I have absolutely no idea why it would do that, it's the first time is does that.
    I tried opening a qt project with MSVC recently, I doubt that would be the reason, but who knows?

    I know I could include it from my c:\Qt file, but IDK where it is, and it would be very anoying to have to do that for every #include.

    Please help!

    Do ask away for any info needed! I thank you already for the help you might provide!

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

      Hi,

      Do you have

      QT += widgets
      

      In your .pro file ?

      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
      1
      • M Offline
        M Offline
        Miixtar
        wrote on last edited by
        #3

        I hadn't put it yet, but when I added it, nothing changed! And QApplication isn't a widget anyway is it?

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

          Did you re-run qmake after modifying the .pro file ?

          It's part of the widgets module.

          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
          • M Offline
            M Offline
            Miixtar
            wrote on last edited by
            #5

            All good, thx.... I realy didn't think QApplication was considered a widget... sorry for asking such a stupid question .. hehe... well thanks!

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

              It is not a widget, it is part of the widgets module because it is responsible of setting the connection with the window manager and other stuff like that.

              Being in the widgets module does not mean that every class in there is a QWidget.

              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
              1
              • M Offline
                M Offline
                Miixtar
                wrote on last edited by
                #7

                Right! Thanks

                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