I just installed QtCreator in Windows, created a project and get many errors default code.
-
@Jed208 said in I just installed QtCreator in Windows, created a project and get many errors default code.:
The version i installed is QtCreator 6.3.1
The version of Qt Creator is not the issue. Your code cannot resolved
#include <QMainWindow>
. So have you installed Qt correctly? -
@JonB said in I just installed QtCreator in Windows, created a project and get many errors default code.:
So have you installed Qt correctly?
And do you add QT += widgets in your pro-file so you can use the QtWidgets library?
-
@JonB I just installed it normally, and the installer didn't give me any errors
EDIT: i just remember, in the installation i choose the 6.4.2, but in the window that displays the option "About Qt Creator" it appears that i have 6.3.1, but the only kit available to use is Desktop Qt 6.2.4 MinGW 64-bit
I don't know if that is the cause of the error.
-
@Christian-Ehrlicher Here are the pro-files
Im so noob in qtcreator, so i don't know is something is missing
-
@Jed208 said in I just installed QtCreator in Windows, created a project and get many errors default code.:
so i don't know is something is missing
And do you add QT += widgets in your pro-file so you can use the QtWidgets library?
I already told you what to do.
-
@Christian-Ehrlicher Oh sorry
I already added that but the error continues -
@Jed208 said in I just installed QtCreator in Windows, created a project and get many errors default code.:
I already added that but the error continues
I doubt it. And your screenshots (whyever we need screenshots for textfiles) does not show this.
-
I added it as follows:
"untitled.pro"TEMPLATE = subdirs QT += widgets SUBDIRS += \ ui
"ui.pro"
QT += core gui QT += widgets 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
And in the header file it still appears 'QMainWindow' File not found
-
You have to re-run qmake after thsi it's also useless to add it to your untitled.pro with the subdirs template.
-
Thanks @Christian-Ehrlicher
I solved the problem by adding the project folder to the directory where I installed qt, it's not the most comfortable but it's what worked for me