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. Good initializer but incomplete type error
QtWS25 Last Chance

Good initializer but incomplete type error

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 2.7k 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.
  • T Offline
    T Offline
    TMahoney1979
    wrote on 14 Mar 2018, 21:18 last edited by
    #1

    Does anyone see a problem with this code, because I do not. Thanks.

    #include <QtGui>

    int main(int argv, char **args)
    {
    QApplication app(args, argv);

    return app.exec();
    

    }

    J 1 Reply Last reply 16 Mar 2018, 04:19
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Mar 2018, 21:20 last edited by
      #2

      Hi and welcome to devnet,

      Change:

      #include <QtGui> by #include <QApplication>

      In any case, if you are using Qt 5, QApplication is in the QtWidget module.

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

      T 1 Reply Last reply 19 Mar 2018, 20:29
      4
      • T TMahoney1979
        14 Mar 2018, 21:18

        Does anyone see a problem with this code, because I do not. Thanks.

        #include <QtGui>

        int main(int argv, char **args)
        {
        QApplication app(args, argv);

        return app.exec();
        

        }

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 16 Mar 2018, 04:19 last edited by
        #3

        @TMahoney1979 said in Good initializer but incomplete type error:

        Does anyone see a problem with this code, because I do not. Thanks.

        ...

        int main(int argv, char **args)
        {
        QApplication app(args, argv);

        @SGaist has identified the main problem.

        However, the code you wrote won't compile either, because argv and args are the wrong way round in your QApplication constructor. (Moreover, they are conventionally int argc and char **argv)

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

        1 Reply Last reply
        5
        • S SGaist
          14 Mar 2018, 21:20

          Hi and welcome to devnet,

          Change:

          #include <QtGui> by #include <QApplication>

          In any case, if you are using Qt 5, QApplication is in the QtWidget module.

          T Offline
          T Offline
          TMahoney1979
          wrote on 19 Mar 2018, 20:29 last edited by
          #4

          Thanks, guys. Do you mean use <QApplication> instead of <QtGui> or include both. Thanks again.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Pablo J. Rogina
            wrote on 19 Mar 2018, 20:30 last edited by
            #5

            @SGaist said in Good initializer but incomplete type error:
            Change #include <QtGui> by #include <QApplication>

            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
            0

            5/5

            19 Mar 2018, 20:30

            • Login

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