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. [SOLVED] Invalid use of incomplete type 'class UI::MainWindow'
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Invalid use of incomplete type 'class UI::MainWindow'

Scheduled Pinned Locked Moved General and Desktop
incomplete typemainwindowqt5.5header cpp qtinclude
30 Posts 4 Posters 57.2k 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.
  • L Lorence
    22 Aug 2015, 17:33

    grassyTile is of type Tile that is inheriting QLabel

    Not sure what you tried to define here ?
    i dont know how to list intialize an array on constructor so i decided to do it in side a class definition

    M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 22 Aug 2015, 17:36 last edited by mrjj
    #4

    @mrjj said:

    and "tile.h" is included ?
    in mainwindow.h

    do you mean like ?
    std::array<std::string, 2> strings = {{ "a", "b" }};

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lorence
      wrote on 22 Aug 2015, 17:46 last edited by
      #5

      and "tile.h" is included ?

      yes i got all i need included.

      do you mean like ?
      std::array<std::string, 2> strings = {{ "a", "b" }};

      yes, in the mainwindow.cpp i can freely use ui->grassyTile; without error.

      M 1 Reply Last reply 22 Aug 2015, 17:55
      0
      • L Lorence
        22 Aug 2015, 17:46

        and "tile.h" is included ?

        yes i got all i need included.

        do you mean like ?
        std::array<std::string, 2> strings = {{ "a", "b" }};

        yes, in the mainwindow.cpp i can freely use ui->grassyTile; without error.

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 22 Aug 2015, 17:55 last edited by
        #6

        @Lorence
        Ok so it must be the tile_list statement.

        Would it like
        std::array<Tile,1> tile_list {{ui->grassyTile }};

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lorence
          wrote on 22 Aug 2015, 18:00 last edited by
          #7

          Would it like
          std::array<Tile,1> tile_list {{ui->grassyTile }};

          thanks for the help but i still get the same error

          M 1 Reply Last reply 22 Aug 2015, 18:03
          0
          • L Lorence
            22 Aug 2015, 18:00

            Would it like
            std::array<Tile,1> tile_list {{ui->grassyTile }};

            thanks for the help but i still get the same error

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 22 Aug 2015, 18:03 last edited by mrjj
            #8

            @Lorence
            Ok, and you are 100% it knows the tile type here?
            you can declare one over the tile_list and it will like it ?
            Tile *Test;

            One thing I wonder, you say
            std::array<Tile> and not std::array<Tile *) or & so it must make a copy of
            it (the tile). Is that the effect you want?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lorence
              wrote on 22 Aug 2015, 18:05 last edited by
              #9

              http://i.imgur.com/3O9O6Vg.png
              this is the error im getting

              M 1 Reply Last reply 22 Aug 2015, 18:08
              0
              • L Lorence
                22 Aug 2015, 18:05

                http://i.imgur.com/3O9O6Vg.png
                this is the error im getting

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 22 Aug 2015, 18:08 last edited by
                #10

                @Lorence
                Hmm it seems its "ui" it do not like.
                Let me test.

                M 1 Reply Last reply 22 Aug 2015, 18:13
                0
                • M mrjj
                  22 Aug 2015, 18:08

                  @Lorence
                  Hmm it seems its "ui" it do not like.
                  Let me test.

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 22 Aug 2015, 18:13 last edited by mrjj
                  #11

                  @mrjj
                  ahh, Ui::MainWindow is defined in
                  #include "ui_main_window.h"
                  which is included in the CPP file so the type is not fully defined so you cannot say
                  ui->Somename
                  as Ui::MainWindow is not defined yet.

                  moving
                  #include "ui_main_window.h"
                  to the minwin.h file allows it but not sure if it will confuse Qt Creator.

                  Also it will complain about not being able to convert Tile to Tile * as list is not pointers and ui->grassyTile will be.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Lorence
                    wrote on 22 Aug 2015, 18:17 last edited by
                    #12

                    ahh, Ui::MainWindow is defined in
                    #include "ui_main_window.h"

                    didnt think of that, thanks! but new error comes

                    http://i.imgur.com/unRPdII.png

                    M 1 Reply Last reply 22 Aug 2015, 18:23
                    0
                    • L Lorence
                      22 Aug 2015, 18:17

                      ahh, Ui::MainWindow is defined in
                      #include "ui_main_window.h"

                      didnt think of that, thanks! but new error comes

                      http://i.imgur.com/unRPdII.png

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 22 Aug 2015, 18:23 last edited by
                      #13

                      @Lorence

                      Yeah, it tries to construct a new Tile to go into the list.

                      Can I ask if you want a list of pointers to tiles you have on screen or
                      a list with new Tiles that has nothing to do with those on screen?

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        Lorence
                        wrote on 22 Aug 2015, 18:30 last edited by Lorence
                        #14

                        sorry for the late reply.

                        i just want a list of tiles to choose from.

                        but QT disabled the copying of QLabel,
                        so i really need to have a pointer of tiles?

                        M 1 Reply Last reply 22 Aug 2015, 18:33
                        0
                        • L Lorence
                          22 Aug 2015, 18:30

                          sorry for the late reply.

                          i just want a list of tiles to choose from.

                          but QT disabled the copying of QLabel,
                          so i really need to have a pointer of tiles?

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 22 Aug 2015, 18:33 last edited by mrjj
                          #15

                          @Lorence
                          heh 9 mins is not considered late ;)

                          then the list must be pointer type or it will be new ones and not the ones on screen.

                          so
                          std::array<Tile> should be std::array<Tile *> or std::array<Tile &>
                          so its the ones on screen and not new ones
                          Yes you must at least use & as it must "point" to the real one.

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            Lorence
                            wrote on 22 Aug 2015, 18:36 last edited by Lorence
                            #16

                            then the list must be pointer type
                            yea, i edited my last reply

                            it will be new ones and not the ones on screen.

                            it is the ones on the screen, there will be a list of tiles on the screen and the user will choose what tiles they want to render

                            *so
                            std::array<Tile> should be std::array<Tile > or std::array<Tile &>
                            so its the ones on screen and not new ones
                            Yes you must at least use & as it must "point" to the real one.

                            thanks!!!!!!!!

                            all my problem is fixed :) I have not coded for weeks and C++ is already kicking me damit

                            M 1 Reply Last reply 22 Aug 2015, 18:38
                            0
                            • L Lorence
                              22 Aug 2015, 18:36

                              then the list must be pointer type
                              yea, i edited my last reply

                              it will be new ones and not the ones on screen.

                              it is the ones on the screen, there will be a list of tiles on the screen and the user will choose what tiles they want to render

                              *so
                              std::array<Tile> should be std::array<Tile > or std::array<Tile &>
                              so its the ones on screen and not new ones
                              Yes you must at least use & as it must "point" to the real one.

                              thanks!!!!!!!!

                              all my problem is fixed :) I have not coded for weeks and C++ is already kicking me damit

                              M Offline
                              M Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on 22 Aug 2015, 18:38 last edited by mrjj
                              #17

                              @mrjj said:
                              ok. Super :)

                              and tile_list is the ones to choose from ?

                              Dont worry. I programmed c++ for 20 years and it still kicks me ;)

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                Lorence
                                wrote on 22 Aug 2015, 18:43 last edited by
                                #18

                                and tile_list is the ones to choose from ?

                                yes, it is a list of Tile which is inheriting QLabel

                                Dont worry. I programmed c++ for 20 years and it still kicks me ;)

                                woaaaaa, me is about a year, and started this QT last week, i choose this for my tile engine's interface from SFML, i still have more ways to go !^_^

                                M 1 Reply Last reply 22 Aug 2015, 18:47
                                0
                                • L Lorence
                                  22 Aug 2015, 18:43

                                  and tile_list is the ones to choose from ?

                                  yes, it is a list of Tile which is inheriting QLabel

                                  Dont worry. I programmed c++ for 20 years and it still kicks me ;)

                                  woaaaaa, me is about a year, and started this QT last week, i choose this for my tile engine's interface from SFML, i still have more ways to go !^_^

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 22 Aug 2015, 18:47 last edited by
                                  #19

                                  @Lorence said:
                                  welcome on board to Qt. its a nice frame work.

                                  Oh so its some sort of game editor your are making ?

                                  1 Reply Last reply
                                  0
                                  • L Offline
                                    L Offline
                                    Lorence
                                    wrote on 22 Aug 2015, 18:52 last edited by
                                    #20

                                    welcome on board to Qt. its a nice frame work.

                                    Yes my first choice is wxwidget and windows form application, but signals and slots mechanism of qt makes me decide to choose qt

                                    Oh so its some sort of game editor your are making ?
                                    yes exatcly, like the rpg maker vx ace of steam

                                    M 1 Reply Last reply 22 Aug 2015, 18:56
                                    0
                                    • L Lorence
                                      22 Aug 2015, 18:52

                                      welcome on board to Qt. its a nice frame work.

                                      Yes my first choice is wxwidget and windows form application, but signals and slots mechanism of qt makes me decide to choose qt

                                      Oh so its some sort of game editor your are making ?
                                      yes exatcly, like the rpg maker vx ace of steam

                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 22 Aug 2015, 18:56 last edited by
                                      #21

                                      @Lorence
                                      Well IMHO Qt is more feature rich than wxwidget even I did like that also.

                                      Oh. Wow. thats a huge project. !
                                      So its an editor and and tile engine for making tile games. Pretty cool.

                                      1 Reply Last reply
                                      0
                                      • L Offline
                                        L Offline
                                        Lorence
                                        wrote on 22 Aug 2015, 19:08 last edited by
                                        #22

                                        Well IMHO Qt is more feature rich than wxwidget even I did like that also.
                                        yea, in other forum's debation, QT always win, whats IMHO?

                                        Oh. Wow. thats a huge project. !
                                        yes this is a huge project for me XD,
                                        and i still got no idea about integrating script language into this project

                                        M 1 Reply Last reply 22 Aug 2015, 19:12
                                        0
                                        • L Lorence
                                          22 Aug 2015, 19:08

                                          Well IMHO Qt is more feature rich than wxwidget even I did like that also.
                                          yea, in other forum's debation, QT always win, whats IMHO?

                                          Oh. Wow. thats a huge project. !
                                          yes this is a huge project for me XD,
                                          and i still got no idea about integrating script language into this project

                                          M Offline
                                          M Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 22 Aug 2015, 19:12 last edited by
                                          #23

                                          @Lorence
                                          IMHO = In my humble opinion
                                          Well I tested both and choose Qt.

                                          Would also be huge for me to make as single person if we are talking full
                                          game editor and engine :)

                                          I would have a good look at http://doc.qt.io/qt-5/qtscript-index.html
                                          Should be fast enough and quite easy to mix c++ and script.

                                          1 Reply Last reply
                                          0

                                          13/30

                                          22 Aug 2015, 18:23

                                          • Login

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