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. Stupid Question need smart answer "incomplete type"
Forum Updated to NodeBB v4.3 + New Features

Stupid Question need smart answer "incomplete type"

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 6 Posters 1.6k Views 3 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by RahibeMeryem
    #1

    Hi,

    I forgot to add QPixmap in one of the header file which there is a QPixmap slot I got error :

    "QPixmap incomplete type"
    

    It took a whiiiiiiiiiile . to realize to include QPixmap to the .h file. Thats fine.

    Isn there any tooling in QtCreator to warn me that I should include QPixmap instead of compiler errors :)

    like Java world asking automatic adding the library :)

    K 1 Reply Last reply
    0
    • R RahibeMeryem

      Hi,

      I forgot to add QPixmap in one of the header file which there is a QPixmap slot I got error :

      "QPixmap incomplete type"
      

      It took a whiiiiiiiiiile . to realize to include QPixmap to the .h file. Thats fine.

      Isn there any tooling in QtCreator to warn me that I should include QPixmap instead of compiler errors :)

      like Java world asking automatic adding the library :)

      K Offline
      K Offline
      kenchan
      wrote on last edited by
      #2

      That is what that compiler message is telling you.

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

        Hi
        The compiler cannot possible know what to include to have a certain type defined.
        Since You can create any number of Types and save in randomly names .cpp / .h file
        its not so easy to have it give suggestions.

        1 Reply Last reply
        5
        • sneubertS Offline
          sneubertS Offline
          sneubert
          wrote on last edited by
          #4

          Hi,

          if you use a Qt-Type just have a look at the documentation.
          For QPixamp see http://doc.qt.io/qt-5/qpixmap.html
          At the top there´s always any header to include and also the qt modules to provide to qmake.

          1 Reply Last reply
          4
          • BuckwheatB Offline
            BuckwheatB Offline
            Buckwheat
            wrote on last edited by
            #5

            @sneubert said in Stupid Question need smart answer "incomplete type":

            At the top there´s always any header to include and also the qt modules to provide to qmake.

            Hi @sneubert

            There are no stupid questions, just thoughtless answers!

            @mrjj and the others are correct with their thoughtful answer. The only thing I would have added is that header files and constructor lists and pointers are kept happy by forward declarations in C++. I am sure you know what I mean. The GNU compiler seems to be happy even with a non-pointer declaration in a class when there is a forward declaration as long as it is not used inline.

            Just know, if you see that error message (and I have too) because if you like to keep nested includes to a minimum or keep functionality hidden then remember to include the header in your CPP file. You don't always have to include the headers in your header file. That is purely a design consideration.

            Dave Fileccia

            J.HilkJ sneubertS 2 Replies Last reply
            0
            • BuckwheatB Buckwheat

              @sneubert said in Stupid Question need smart answer "incomplete type":

              At the top there´s always any header to include and also the qt modules to provide to qmake.

              Hi @sneubert

              There are no stupid questions, just thoughtless answers!

              @mrjj and the others are correct with their thoughtful answer. The only thing I would have added is that header files and constructor lists and pointers are kept happy by forward declarations in C++. I am sure you know what I mean. The GNU compiler seems to be happy even with a non-pointer declaration in a class when there is a forward declaration as long as it is not used inline.

              Just know, if you see that error message (and I have too) because if you like to keep nested includes to a minimum or keep functionality hidden then remember to include the header in your CPP file. You don't always have to include the headers in your header file. That is purely a design consideration.

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by J.Hilk
              #6

              @Buckwheat said in Stupid Question need smart answer "incomplete type":

              You don't always have to include the headers in your header file. That is purely a design consideration.

              Nope, that's also a compile-time question. Cramming your header full of all unneed includes can push your compile time up, rather quickly in fact.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              1
              • BuckwheatB Offline
                BuckwheatB Offline
                Buckwheat
                wrote on last edited by
                #7

                @J.Hilk said in Stupid Question need smart answer "incomplete type":

                hat's also a compile-time question. Cramming your header full of all unneed includes can push your compile time up, rather quickly in fac

                @J-Hilk
                You are correct if you never use instances. I hate unnecessary includes for that reason. Some designs require non-pointer members so including the headers is a must. The rule is... only include what you need to cleanly compile and test your object. So, again, it is a design matter.

                Unfortunately, some advice is given to "just include the header because its in the docs" or young developers just think they have to do it that way and senior developers seem to not want to take the time to mentor young programmers to engineer proper software.

                Dave Fileccia

                1 Reply Last reply
                0
                • BuckwheatB Buckwheat

                  @sneubert said in Stupid Question need smart answer "incomplete type":

                  At the top there´s always any header to include and also the qt modules to provide to qmake.

                  Hi @sneubert

                  There are no stupid questions, just thoughtless answers!

                  @mrjj and the others are correct with their thoughtful answer. The only thing I would have added is that header files and constructor lists and pointers are kept happy by forward declarations in C++. I am sure you know what I mean. The GNU compiler seems to be happy even with a non-pointer declaration in a class when there is a forward declaration as long as it is not used inline.

                  Just know, if you see that error message (and I have too) because if you like to keep nested includes to a minimum or keep functionality hidden then remember to include the header in your CPP file. You don't always have to include the headers in your header file. That is purely a design consideration.

                  sneubertS Offline
                  sneubertS Offline
                  sneubert
                  wrote on last edited by
                  #8

                  Hi @Buckwheat

                  are you related to Roland Hughes from Logikal Solutions?

                  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