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. Lost my QApplication

Lost my QApplication

Scheduled Pinned Locked Moved Unsolved General and Desktop
beginnerheaderqapplication
12 Posts 4 Posters 3.4k 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.
  • A Offline
    A Offline
    astroannie
    wrote on last edited by
    #3

    Okay, the tutorial is C++ Qt Programming by VoidRealms -- I don't know how to get the nitty-gritty on which Qt I'm using except I downloaded it Tuesday so it's pretty new. (Help > About tells about QtCreator). And yes, I'm running Avast.

    It's not my executable -- that one I can fix by logging out and logging back in again. This is an error where it says that it can't open QApplication Here's the code:

    #include <QApplication>
    #include <QLabel>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QLabel *label = new QLabel("Hello world");
    
        label->show();
    
        return app.exec();
    }
    

    ... and here's the error:
    C:\QtWorkspace\minimal\main.cpp:1: error: C1083: Cannot open include file: 'QApplications': No such file or directory

    Is this more helpful?

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

      Hi
      Do you have a project file ?
      Its often called a .pro
      in that file, you might need
      QT += core gui

      You can also test by selecting new from menu and create new GUI application.
      (just next next it)
      Then run it.
      If that works, your Qt is fine.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        astroannie
        wrote on last edited by astroannie
        #5

        Sorry, it's QApplication -- no s -- I typed it instead of copy/paste. I learned though -- here's my .pro file

        QT += core gui
        
        SOURCES += \
            main.cpp
        
        
        1 Reply Last reply
        1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          ahh. ok. good catch :)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            astroannie
            wrote on last edited by
            #7

            I told Avast to exclude my workspace. It's still not being able to find the QApplication -- same message. I even tried restarting to no avail.

            (I didn't realize you could copy/paste errors -- my old IDE was wonky about that). Here is what it really says, copy/pasted for your convenience:

            C:\QtWorkspace\minimal\main.cpp:1: error: C1083: Cannot open include file: 'QApplication': No such file or directory

            K 1 Reply Last reply
            0
            • A astroannie

              I told Avast to exclude my workspace. It's still not being able to find the QApplication -- same message. I even tried restarting to no avail.

              (I didn't realize you could copy/paste errors -- my old IDE was wonky about that). Here is what it really says, copy/pasted for your convenience:

              C:\QtWorkspace\minimal\main.cpp:1: error: C1083: Cannot open include file: 'QApplication': No such file or directory

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #8

              @astroannie
              You are using Qt creator as your new IDE?
              You have the setup from your install process for Qt?

              In Qt creator go to menu "Tools" -> "Options" -> "Build&Run" what can you see under the different tabs?
              Are there some warnings?

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              1
              • A Offline
                A Offline
                astroannie
                wrote on last edited by
                #9

                @koahnig
                Okay, I looked.

                My compiler is (not copy/pastable) Microsoft Visual C++ 10.0 (x86).

                My Qt versions are 5.4.2 and 5.5.1 (both). Would removing one help?

                The only thing I have warnings on is Kits -- which I didn't know I even had. They have little triangles with ! in them. One is Qt5.4.2 MSVC2010 OpenGL 32bit and the other is Qt5.5.1 MSVC2010 32-bit (default)

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

                  Hi and welcome to devnet,

                  You are missing QT += widgets in your .pro file.

                  With Qt 5, the widgets have moved into their own 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
                  1
                  • A Offline
                    A Offline
                    astroannie
                    wrote on last edited by
                    #11

                    Bless you sir, I regret that I can thumb you up but the once.

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

                      No worries for that :)

                      Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

                      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