QT Creator cannot find <Qdialog> in Windows 10
-
Just installed QT 5.11.2 on Windows 10
Start QT Creator and start a new project.
Everything on that display looks ok. However, when I write:
#include <QDialog>
The error message is: Lexical or processor error…. QDialog not found
There is a set up that is not “set up.” Where do I look?
So this is tried: Right click on the project, select Add Library -> Internal library -> Next
The result is a blank path. I don’t know what QT wants. A hint would be nice
Run a CMD window and a search for QDialog* that requires >5 minutes to complete and returns nothing.
Run a Windows Explorer search and it finds many false positives, has not completed after more than ten minutes, and no positives.Select this: C:\Qt5\5.11.2\winrt_x64_msvc2017\include
Enter it into the Add Library dialog, and the Next box is disabled. Only Cancel is enabled.
What should be done? -
- doed the error disappear when you press compile?
- do you have
CONFIG+= GUI WIDGETS
QT += widgets
in your pro file? [EDIT: Fixed options --JKSH] - do you really want to build UWP apps or classic Windows applications?
-
@aha_1980 said in QT Creator cannot find <Qdialog> in Windows 10:
do you have CONFIG+= GUI WIDGETS in your pro file?
Actually
QT += core guiQT += widgets
should be enough for a widget application. [EDIT: Fixed options --JKSH]
-
@jsulm said in QT Creator cannot find <Qdialog> in Windows 10:
@aha_1980 said in QT Creator cannot find <Qdialog> in Windows 10:
do you have CONFIG+= GUI WIDGETS in your pro file?
Actually
QT += core gui
should be enough for a widget application.
Not in Qt5 ;)
-
There is no compile button. There is Build -> Build All, Build -> Build Project <project_name>, Build -> Rebuild All, but nothing with the moniker Compile. And no, they don’t fix the problem. If it cannot find QDialog, then the build process will not succeed.
The first two lines in ex01.pro are:
QT += quick CONFIG += c++11
So added the line: CONFIG += GUI WIDGETS, still cannot find QDialog. The first error message is:
Type ‘QDialog’ is not a direct or virtual base of FindDialog.UWP apps: Never heard of that, looked it up, and no, I will be happy with a regular windows app.
And just to be sure added: QT += core gui to the .pro file to no avail.
And just discovered that at home there are some icons not displayed when logged on at work, one of which does formatting. No edit option at work.
-
Re: If you don't need UWP then please install Qt for the regular Microsoft C++ compiler and try again using the new Kit.
I didn't detect the two different installs. If you can, please redirect me to a site that describes all the options and which ones are needed for a basic windows install. I will search when I get home from work but that will be a while.Side question: I access the internet through government firewalls at work and they block many things. At home this forum provides options not present at work, such as bolding, italics, and an icon with the characters "</>" that works for quoting code. I tried editing in several standard phrases such as:
[CODE] line of code [/CODE]
but the ones I attempted were not successful. If you know, please advise me of the character strings that will identify quotes and code causing them to be more obvious in our posts. -
Hi,
It's not
CONFIG
butQT += widgets
that your need.As for the code format it's three backticks, start a new line, then again three backticks on a new line.
-
@jsulm Re If you don't need UWP then please install Qt for the regular Microsoft C++ compiler and try again using the new Kit.
I have installed twice now. It cannot find one or more files. Why would a reduced install make the files easier to find. I have searched a bit and not found anything that describes the purpose of each install option. Does anyone have a link for that information.
testing for quoted text.
Works well, thanks JKSH, will try the other items tomorrow. -
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
QT += quick
Change that line into
QT += widgets quick
.(And just to double check: Are you using Qt Quick? If not, then
QT += widgets
is enough)@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
please advise me of the character strings that will identify quotes and code causing them to be more obvious in our posts.
For quotes, put
>
on the left of your text. -
Here is the pro file. I have added a few lines at the top but otherwise unchanged from the auto-generated file. Most comments removed for brevity.
QT += quick CONFIG += c++11 CONFIG += GUI WIDGETS QT += core gui QT += widgets DEFINES += QT_DEPRECATED_WARNINGS Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ finddialog.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
I am using QT Creator 4.8.0-rc1 (4.7.84) based on Qt 5.12.0
It is behaving a bit strange. I can manually open the .h file, but it won't stay open in the explorer panel. This is my first attempt with QT Creator. Is that normal?
The code I am using is right out of the book. -
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
Here is the pro file. I have added a few lines at the top but otherwise unchanged from the auto-generated file.
Since you are using Qt Widgets and not Qt Quick, I suggest starting from scratch and creating a new project altogether: File > New File or Project... > Application > Qt Widgets Application
Also, when selecting a Kit, pick a "desktop" kit (MSVC or MinGW), not a "mobile" kit (UWP/WinRT or Android)
This should let you find QDialog out-of-the-box, without needing you to mess around with the .pro file.
I am using QT Creator 4.8.0-rc1 (4.7.84) based on Qt 5.12.0
Note: Qt Creator 4.8.0 has not been released yet. This is a preview version.
It should work fine, but it's best to stick to official releases when you're starting out.
-
Just FYI, Qt 5.12 and Qt Creator 4.8 have been released today :-)
-
@SGaist said in QT Creator cannot find <Qdialog> in Windows 10:
Just FYI, Qt 5.12 and Qt Creator 4.8 have been released today :-)
Time to upgrade! :D
-
replying to several posts at once:
From the QT web site I picked the latest release. There was nothing there to indicate that it was beta or anything other than a stable release.
Ok, so I need to install for the third time.
Questions:
Which release should I install?
When items should be and should not be installed? I wish to build applications for Windows 10. I have Visual Studio 2017 installed.
Should I use Visual Studio or some app within the QT environment to build my app?If at some time in the future I wish to rebuild the app for android, how difficult will that be? What will I need to add?