Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. New Qt installation, simple QWidget App does not compile
QtWS25 Last Chance

New Qt installation, simple QWidget App does not compile

Scheduled Pinned Locked Moved Solved Installation and Deployment
18 Posts 7 Posters 206 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote last edited by Chris Kawa
    #1

    Hello,
    I am on the way to a new Creator and Qt Version and have created a simple Qt-Widget project via the wizzard. This unchanged project does not compile in all my installed Qt-Kits.

    (Windows, MSVC different versions)

    :-1: Fehler: dependent '..\..\..\..\..\..\Qt\6.9.0\msvc2022_64\include\QtWidgets\qmainwindow.h' does not exist.

    What kind of error is it ? It is not an include error, like "file missing ...."

    I try to compile only one file, I get this error always at first independet of the contet of the file (error nonsens in first line)
    The lot of " \.. " do not match the location of my file.
    The file D:\Qt\6.9.0\msvc2022_64\include\QtWidgets\qmainwindow.h" exists.
    I have my old Creator/Qt on C: alive, but the pathes in the new version seem all correct refer to the new version.

    I am at a loss.

    Thanks for help
    Andreas

    H 1 Reply Last reply
    0
    • Andy314A Andy314

      Hello,
      I am on the way to a new Creator and Qt Version and have created a simple Qt-Widget project via the wizzard. This unchanged project does not compile in all my installed Qt-Kits.

      (Windows, MSVC different versions)

      :-1: Fehler: dependent '..\..\..\..\..\..\Qt\6.9.0\msvc2022_64\include\QtWidgets\qmainwindow.h' does not exist.

      What kind of error is it ? It is not an include error, like "file missing ...."

      I try to compile only one file, I get this error always at first independet of the contet of the file (error nonsens in first line)
      The lot of " \.. " do not match the location of my file.
      The file D:\Qt\6.9.0\msvc2022_64\include\QtWidgets\qmainwindow.h" exists.
      I have my old Creator/Qt on C: alive, but the pathes in the new version seem all correct refer to the new version.

      I am at a loss.

      Thanks for help
      Andreas

      H Offline
      H Offline
      HQ2000
      wrote last edited by HQ2000
      #2

      Hi @Andy314 ,
      As a Qt Beginner I do wonder why your path is "D:..." instead of "C:..." since you say you have you have set up Qt at the C: directory...
      When searching for this path ("D" replaced with "C") in my own Qt6.9.0 installation, I flawlessly find this file.
      Correct me if I didn't understand your problem correctly.

      Andy314A 1 Reply Last reply
      0
      • H HQ2000

        Hi @Andy314 ,
        As a Qt Beginner I do wonder why your path is "D:..." instead of "C:..." since you say you have you have set up Qt at the C: directory...
        When searching for this path ("D" replaced with "C") in my own Qt6.9.0 installation, I flawlessly find this file.
        Correct me if I didn't understand your problem correctly.

        Andy314A Offline
        Andy314A Offline
        Andy314
        wrote last edited by Andy314
        #3

        @HQ2000 said in New Qt installation, simple QWidget App does not compile:

        Hi @Andy314 ,
        As a Qt Beginner I do wonder why your path is "D:..." instead of "C:..." since you say you have you have set up Qt at the C: directory...
        When searching for this path ("D" replaced with "C") in my own Qt6.9.0 installation, I flawlessly find this file.
        Correct me if I didn't understand your problem correctly.

        My old working installation is on C: and my new on D:
        I must remain able to work for my job. Only when the new version works correctly will I delete the old one.
        Since years I make the update in this way and had never problems with it.

        H 1 Reply Last reply
        0
        • Andy314A Andy314

          @HQ2000 said in New Qt installation, simple QWidget App does not compile:

          Hi @Andy314 ,
          As a Qt Beginner I do wonder why your path is "D:..." instead of "C:..." since you say you have you have set up Qt at the C: directory...
          When searching for this path ("D" replaced with "C") in my own Qt6.9.0 installation, I flawlessly find this file.
          Correct me if I didn't understand your problem correctly.

          My old working installation is on C: and my new on D:
          I must remain able to work for my job. Only when the new version works correctly will I delete the old one.
          Since years I make the update in this way and had never problems with it.

          H Offline
          H Offline
          HQ2000
          wrote last edited by HQ2000
          #4

          @Andy314
          Ah, ok. I'm still a beginner as mentioned before, but aren't there some other settings in QtCreator you need to change if you want to use another installation? Or do you use the QTCreator you potentially installed with the new installation in D:?

          Andy314A 1 Reply Last reply
          0
          • H HQ2000

            @Andy314
            Ah, ok. I'm still a beginner as mentioned before, but aren't there some other settings in QtCreator you need to change if you want to use another installation? Or do you use the QTCreator you potentially installed with the new installation in D:?

            Andy314A Offline
            Andy314A Offline
            Andy314
            wrote last edited by Andy314
            #5

            @HQ2000 said in New Qt installation, simple QWidget App does not compile:

            @Andy314
            Ah, ok. I'm still a beginner as mentioned before, but aren't there some other settings in QtCreator you need to change if you want to use another installation? Or do you use the QTCreator you potentially installed with the new installation in D:?

            Switching to a newer Qt version is unproblematic. You install additional new kits (Qt Version) in the Creator an try it out.
            But from time to time I make a complete new full installation inclusive a new creator. (Of course the creator itself is updatable too but this is to much risk for me and sometimes its better to start from the scatch to get rid of old stuff)
            The new Creator copys most settings from the old installation automatically. So parallel working with 2 versions of the Creator+Qt is umproblematic.
            The maintaince tool for every version installs the packages for in correct creator in its corrosponding pathes.

            1 Reply Last reply
            0
            • Axel SpoerlA Offline
              Axel SpoerlA Offline
              Axel Spoerl
              Moderators
              wrote last edited by
              #6

              Can you post you CMakeLists.txt or .pro file?

              Software Engineer
              The Qt Company, Oslo

              Andy314A 1 Reply Last reply
              0
              • Axel SpoerlA Axel Spoerl

                Can you post you CMakeLists.txt or .pro file?

                Andy314A Offline
                Andy314A Offline
                Andy314
                wrote last edited by
                #7

                @Axel-Spoerl said in New Qt installation, simple QWidget App does not compile:

                Can you post you CMakeLists.txt or .pro file?

                Her is the pro file:

                QT       += core gui
                
                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                
                CONFIG += c++17
                
                # You can make your code fail to compile if it uses deprecated APIs.
                # In order to do so, uncomment the following line.
                #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                
                SOURCES += \
                    main.cpp \
                    MainWindow.cpp
                
                HEADERS += \
                    MainWindow.h
                
                FORMS += \
                    MainWindow.ui
                
                # Default rules for deployment.
                qnx: target.path = /tmp/$${TARGET}/bin
                else: unix:!android: target.path = /opt/$${TARGET}/bin
                !isEmpty(target.path): INSTALLS += target
                
                
                1 Reply Last reply
                0
                • hskoglundH Offline
                  hskoglundH Offline
                  hskoglund
                  wrote last edited by
                  #8

                  Maybe you need to delete your .pro.user file when switching your project from one QtCreator to another QtCreator.

                  Andy314A 1 Reply Last reply
                  0
                  • hskoglundH hskoglund

                    Maybe you need to delete your .pro.user file when switching your project from one QtCreator to another QtCreator.

                    Andy314A Offline
                    Andy314A Offline
                    Andy314
                    wrote last edited by
                    #9

                    @hskoglund said in New Qt installation, simple QWidget App does not compile:

                    Maybe you need to delete your .pro.user file when switching your project from one QtCreator to another QtCreator.

                    Done multiple time. Deleting complete build folder. No effect !

                    jsulmJ 1 Reply Last reply
                    0
                    • Andy314A Andy314

                      @hskoglund said in New Qt installation, simple QWidget App does not compile:

                      Maybe you need to delete your .pro.user file when switching your project from one QtCreator to another QtCreator.

                      Done multiple time. Deleting complete build folder. No effect !

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote last edited by
                      #10

                      @Andy314 said in New Qt installation, simple QWidget App does not compile:

                      Deleting complete build folder

                      Not the build folder, the .pro.user file in the project directory.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Andy314A 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Andy314 said in New Qt installation, simple QWidget App does not compile:

                        Deleting complete build folder

                        Not the build folder, the .pro.user file in the project directory.

                        Andy314A Offline
                        Andy314A Offline
                        Andy314
                        wrote last edited by
                        #11

                        @jsulm said in New Qt installation, simple QWidget App does not compile:

                        @Andy314 said in New Qt installation, simple QWidget App does not compile:

                        Deleting complete build folder

                        Not the build folder, the .pro.user file in the project directory.

                        Yes I did it too.

                        1 Reply Last reply
                        0
                        • Andy314A Offline
                          Andy314A Offline
                          Andy314
                          wrote last edited by Andy314
                          #12

                          Some effects I found. I can compile all my old projects with Qt 5.15.2 with qmake.
                          A new qmake test project or additional kid for my old projects do run never !
                          So the problem seem to be creation a new projekt independent of Qt version.

                          On the other side cmake projects work all.

                          The error occurs befor real compiling of a cpp-file starts. If it put an error in the first line of a file and compile this, I dont get this error. I get only :

                          -1: Fehler: dependent '..\..\..\..\..\..\Qt\6.5.3\msvc2019_64\include\QtWidgets\QMainWindow'
                           does not exist
                          

                          For some projects I get:

                          :-1: Fehler: dependent '..\..\..\..\..\Qt\6.8.3\msvc2022_64\include\QtWidgets\QWidget' does not exist.
                          

                          What kind of errors are this. It is not a compiler nor a linker error. It seem a "project-build-error".

                          1 Reply Last reply
                          0
                          • aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote last edited by
                            #13

                            @Andy314 I have seen this kind of error when the build directory is below the source directory, and it does not happen when the build directory is parallel to the source directory (as QtCreator forced it for a long time).

                            So the project: C:\Users\user\projects\foo should have a build dir C:\Users\user\projects\build-foo.

                            Please try to setup the project again, and change the path to the build directory in the project settings before compiling.

                            Qt has to stay free or it will die.

                            Andy314A 1 Reply Last reply
                            2
                            • aha_1980A aha_1980

                              @Andy314 I have seen this kind of error when the build directory is below the source directory, and it does not happen when the build directory is parallel to the source directory (as QtCreator forced it for a long time).

                              So the project: C:\Users\user\projects\foo should have a build dir C:\Users\user\projects\build-foo.

                              Please try to setup the project again, and change the path to the build directory in the project settings before compiling.

                              Andy314A Offline
                              Andy314A Offline
                              Andy314
                              wrote last edited by
                              #14

                              @aha_1980 said in New Qt installation, simple QWidget App does not compile:

                              @Andy314 I have seen this kind of error when the build directory is below the source directory, and it does not happen when the build directory is parallel to the source directory (as QtCreator forced it for a long time).

                              So the project: C:\Users\user\projects\foo should have a build dir C:\Users\user\projects\build-foo.

                              Please try to setup the project again, and change the path to the build directory in the project settings before compiling.

                              Oh man, thank you very much. This is the solution !
                              I am happy.

                              In my old projects I configure it always in that way, because I hate to mix source and target -> complicated (large) repository/backup etc.

                              But how stupid is that bug of the buildsysthem - default configuration creates a brocken project.
                              I assume this is not a inescapable bug, other condition may contribute their part.

                              1 Reply Last reply
                              1
                              • aha_1980A Offline
                                aha_1980A Offline
                                aha_1980
                                Lifetime Qt Champion
                                wrote last edited by
                                #15

                                @Andy314 I agree this is a stupid bug, but as qmake gets lower and lower support I doubt there will be a fix.

                                If you like, you can still report a bug but I don't think it will be high priority.

                                Qt has to stay free or it will die.

                                L 1 Reply Last reply
                                0
                                • Andy314A Andy314 has marked this topic as solved
                                • aha_1980A aha_1980

                                  @Andy314 I agree this is a stupid bug, but as qmake gets lower and lower support I doubt there will be a fix.

                                  If you like, you can still report a bug but I don't think it will be high priority.

                                  L Offline
                                  L Offline
                                  lijihong
                                  wrote last edited by
                                  #16

                                  @aha_1980 :

                                  -1: error: dependent '..\..\..\..\..\..\qt\QT\6.9.0\msvc2022_64\include\QtWidgets\QMainWindow' does not exist.
                                  

                                  Hello, may I ask my question is also this, what do I need to change?

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • L lijihong

                                    @aha_1980 :

                                    -1: error: dependent '..\..\..\..\..\..\qt\QT\6.9.0\msvc2022_64\include\QtWidgets\QMainWindow' does not exist.
                                    

                                    Hello, may I ask my question is also this, what do I need to change?

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote last edited by
                                    #17

                                    @lijihong said in New Qt installation, simple QWidget App does not compile:

                                    what do I need to change?

                                    Did you read what @aha_1980 wrote?
                                    Make sure your build folder is NOT inside the source folder.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    L 1 Reply Last reply
                                    1
                                    • jsulmJ jsulm

                                      @lijihong said in New Qt installation, simple QWidget App does not compile:

                                      what do I need to change?

                                      Did you read what @aha_1980 wrote?
                                      Make sure your build folder is NOT inside the source folder.

                                      L Offline
                                      L Offline
                                      lijihong
                                      wrote last edited by
                                      #18

                                      @jsulm
                                      Nice, thank you, I tried to build the MSVC2022 project in QtCreaator, this problem has been bothering me, and now it has finally been solved, the same project Visual Studio can run, I want to switch the IDE, hahahahaha

                                      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