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. Problem with QMain Window
Qt 6.11 is out! See what's new in the release blog

Problem with QMain Window

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 1.5k 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi
    Unless you are using a super old Qt then its just
    #include <QMainWindow>

    also, make SURE no moc__ files are in the project folder. They are generated and should live in the build folder.
    If it find old moc__ files, odd stuff will happen :)

    E 1 Reply Last reply
    0
    • mrjjM mrjj

      Hi
      Unless you are using a super old Qt then its just
      #include <QMainWindow>

      also, make SURE no moc__ files are in the project folder. They are generated and should live in the build folder.
      If it find old moc__ files, odd stuff will happen :)

      E Offline
      E Offline
      Ewa Miazga
      wrote on last edited by
      #3

      @mrjj Hi,
      I had the newest version of Qt, but I don't know why I can't #include <QMainWindow>, because for some reasons ' cannot open source faile "QMainWindow".'
      I should remove all files moc__ .. cpp also? I find them in project in folder x64/release/moc.
      In pre-build event -> command line is command that creates moc.exe MainWindow.h -o moc_MainWindow.cpp
      moc.exe GuiUpdatingThread.h -o moc_GuiUpdatingThread.cpp

      mrjjM 1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #4

        if pro file is used, list its content here.

        E 1 Reply Last reply
        1
        • E Ewa Miazga

          @mrjj Hi,
          I had the newest version of Qt, but I don't know why I can't #include <QMainWindow>, because for some reasons ' cannot open source faile "QMainWindow".'
          I should remove all files moc__ .. cpp also? I find them in project in folder x64/release/moc.
          In pre-build event -> command line is command that creates moc.exe MainWindow.h -o moc_MainWindow.cpp
          moc.exe GuiUpdatingThread.h -o moc_GuiUpdatingThread.cpp

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @Ewa-Miazga said in Problem with QMain Window:

          x64/release/moc.

          This seems ok as not a project folder directly.
          But it also seems non standard which means that the -pro file might be special.

          Have you tried to go
          File->New Project
          alt text

          then just Next, Next

          Then you get a clean project with QMainWindow

          Its just to see if that ones just works so we know if its this project somehow or something with the installation

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

            Hi,

            Seeing the age of the project, you likely are missing QT += widgets in your .pro file.

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

            E 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              Seeing the age of the project, you likely are missing QT += widgets in your .pro file.

              E Offline
              E Offline
              Ewa Miazga
              wrote on last edited by
              #7

              @SGaist I added it, but it changed nothing.

              1 Reply Last reply
              0
              • JoeCFDJ JoeCFD

                if pro file is used, list its content here.

                E Offline
                E Offline
                Ewa Miazga
                wrote on last edited by
                #8

                @JoeCFD
                in .pro file:
                CONFIG += no_fixpath
                QT += core uitools widgets

                    DEFINES -= UNICODE _UNICODE
                
                1 Reply Last reply
                0
                • mrjjM mrjj

                  @Ewa-Miazga said in Problem with QMain Window:

                  x64/release/moc.

                  This seems ok as not a project folder directly.
                  But it also seems non standard which means that the -pro file might be special.

                  Have you tried to go
                  File->New Project
                  alt text

                  then just Next, Next

                  Then you get a clean project with QMainWindow

                  Its just to see if that ones just works so we know if its this project somehow or something with the installation

                  E Offline
                  E Offline
                  Ewa Miazga
                  wrote on last edited by
                  #9

                  @mrjj
                  It works.
                  I decided to copy all the files to new console application qt project in visual studio and now I have plenty of unexternal symbols...

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

                    The suggestion is to create a Qt Widgets application so you ensure that it's properly configured to build using the widgets module.

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

                    E 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      The suggestion is to create a Qt Widgets application so you ensure that it's properly configured to build using the widgets module.

                      E Offline
                      E Offline
                      Ewa Miazga
                      wrote on last edited by
                      #11

                      @SGaist I checked it. It works.

                      1 Reply Last reply
                      1

                      • Login

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