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. Error : can't run my program
Qt 6.11 is out! See what's new in the release blog

Error : can't run my program

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 1.1k Views 2 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.
  • C Offline
    C Offline
    CyberSnake
    wrote on last edited by
    #1

    Hello everyone, I'm new, and I'm trying to use qt for a Linux application.

    I'm on Linux mint and the version of qt I'm using is 5.12.8.

    I created an empty project to start with. My pro file contains the following configuration:

    SOURCES += \
        main.cpp
    QT += core
    QT += widgets
    
    

    and my main.cpp contains the following code:

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

    The problem is that qt tells me on line 4:
    variable has incomplete type Qapplication.

    Can you help me solve this problem, thank you in advance.

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

      Hi and welcome to devnet,

      You are missing

      #include <QApplication>
      

      in your main.cpp file.

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

      C 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi and welcome to devnet,

        You are missing

        #include <QApplication>
        

        in your main.cpp file.

        C Offline
        C Offline
        CyberSnake
        wrote on last edited by
        #3

        @SGaist said in Error : can't run my program:

        Hi and welcome to devnet,

        You are missing

        #include <QApplication>
        

        in your main.cpp file.

        Hello again.

        I had inclued <QApplication> but i have the same error :(

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Hi, also please check, on line 4, that you have written
          QApplication
          and not
          Qapplication

          C 1 Reply Last reply
          0
          • hskoglundH hskoglund

            Hi, also please check, on line 4, that you have written
            QApplication
            and not
            Qapplication

            C Offline
            C Offline
            CyberSnake
            wrote on last edited by
            #5

            @hskoglund Typing mistake... But even with QApplication I have the same mistake.

            Pablo J. RoginaP JonBJ 2 Replies Last reply
            0
            • C CyberSnake

              @hskoglund Typing mistake... But even with QApplication I have the same mistake.

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6

              @CyberSnake Instead of looking for a needle in a haystack, are you able to build and run any Qt example?

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              1
              • C CyberSnake

                @hskoglund Typing mistake... But even with QApplication I have the same mistake.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @CyberSnake
                You are claiming that if you copy & paste the following code:

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

                you will get one error message of

                variable has incomplete type QApplication.
                

                Is that right? If you copy & paste the above? With no other error about not being able to find the header file? Is this a compile-time error, or a message from Qt Creator when you just look at the code?

                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