New Qt installation, simple QWidget App does not compile
-
Can you post you CMakeLists.txt or .pro file?
-
Can you post you CMakeLists.txt or .pro file?
@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
-
Maybe you need to delete your .pro.user file when switching your project from one QtCreator to another QtCreator.
@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 !
-
@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 !
@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.
-
@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.
@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.
-
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".
-
@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 dirC:\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.
-
@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 dirC:\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.
@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 dirC:\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. -
A Andy314 has marked this topic as solved
-
@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.
-
-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?
@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. -
@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.