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?


  • Qt Champions 2018

    @BKBK

    • 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?

  • Moderators

    @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

    QT += widgets
    

    should be enough for a widget application. [EDIT: Fixed options --JKSH]


  • Qt Champions 2018

    @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 ;)


  • Moderators

    @aha_1980 Sorry, you're right



  • 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.


  • Moderators

    @BKBK If you don't need UWP then please install Qt for the regular Microsoft C++ compiler and try again using the new Kit.



  • 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.


  • Lifetime Qt Champion

    Hi,

    It's not CONFIG but QT += 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.



  • Thanks for the reply. Lets try the code makers with:

    x = y;
    

    Ok, I got that thank you.



  • @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.


  • Moderators

    @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.



  • I am not using Qt Quick, just trying to get the first simple app running.


  • Qt Champions 2018

    @BKBK

    So can you show your .pro file?



  • 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.


  • Moderators

    @BKBK Is there a reason why you're using a release candidate and not a stable version?


  • Moderators

    @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.


  • Lifetime Qt Champion

    Just FYI, Qt 5.12 and Qt Creator 4.8 have been released today :-)


  • Moderators

    @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?


  • Moderators

    @BKBK said in QT Creator cannot find <Qdialog> in Windows 10:

    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.

    This sounds like a deficiency in the website; all pre-release builds need to be clearly labelled.

    Can you post the link to the page where you picked the latest release? (Note: Qt 5.12 and Qt Creator 4.8 have just been released, so they are now official)

    EDIT: I just had a thought: Did you select Preview > Qt Creator 4.8.0-rc1 from the installer? That might have been why you got a preview version. FYI, "RC" stands for "Release Candidate"

    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?

    See https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI for a fully detailed walkthrough. (If you have time, I would be grateful if you provide feedback on what's helpful and what's unclear in the document)

    In summary:

    • Use the Online installer.
    • Install Qt > Qt 5.12.0 > MSVC 2017 32-bit
      • Since you already have Visual Studio 2017, this is the only thing you need.
      • You can choose MSVC 2017 64-bit instead, if you prefer.
    • Qt Creator, the IDE, is automatically installed; you don't need to select it.
    • Use Qt Creator to build your app.

    In Qt Creator, select File > New File or Project... > Application > Qt Widgets Application to create your first project.

    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?

    When that time comes,

    1. Run MaintenanceTool.exe from the root folder where you installed Qt
    2. Select Add/Remove Components
    3. Select Qt > Qt 5.12.0 > Android _____

    You will also need to separately install the Android development tools from Google. See https://doc.qt.io/qt-5/android-getting-started.html for details.



  • @JKSH said in QT Creator cannot find <Qdialog> in Windows 10:

    See https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI for a fully detailed walkthrough. (If you have time, I would be grateful if you provide feedback on what's helpful and what's unclear in the document)

    I detected my first error. When I saw the Preview option in the installed dialogs I presumed it meant to preview what I am about to install. After making that correction the install was much faster.
    Some comments.

    As I follow the Get Started thread of the creator I want the ability to separate that text and guidance from the creator so I can see it while I create the project. One on each monitor.

    When selecting the components, please shown the total amount of data to be downloaded for each.
    I am working it now but wanted to post before I spend considerable time in getting the first project running.
    So far, so good.
    Thanks for your details.



  • The install has been completed. Worked through a few menus and a few referenced web pages and found the example code for basic layouts. The project directory is here:
    C:\QT5\Examples\Qt-5.12.0\widgets\layouts\basiclayouts
    This line is flagged
    #include <QApplication>
    And the error QApplication not found.
    I surmise there is a fundamental setup step to perform that I missed. Please advise me of where to find it.


  • Lifetime Qt Champion

    I would do a search in the Qt installation to ensure that the file is there (and it should).



  • Yes, it exists, here: "C:\QT5\5.12.0\msvc2017_64\include\QtWidgets\QApplication"
    After looking around the menu's for Qt Creator I don't see anything to indicate that the paths should be entered there for all projects. A right click on the project in the project explorer (the left panel of Creator) brings up a dialog that leads to a dialog to Add Library. When the path is pasted in the Next button remains disabled. Only the Cancel is enabled. That screen capture has been uploaded.
    When Visual Studio was installed, several times and multiple versions over the years, it never required the user to find all the libraries such as <iostream.h> and specifically tell VS where to find them. I do expect the same of Qt.
    edit: the point of the image is, in part: The dialog will not allow any editing in field Library:, field Include path contains a path, yet button Next is disabled. Please provide some information as to why the Next button is disabled.

    0_1544304309925_cannot add library.JPG


  • Qt Champions 2018

    @BKBK Did you already build the project or was it just the inline error from the code model that showed up? I have seen that too a couple of times before the project was build first.



  • That was from the first attempt. The first project has yet to be built.


  • Moderators

    @BKBK said in QT Creator cannot find <Qdialog> in Windows 10:

    The install has been completed. Worked through a few menus and a few referenced web pages and found the example code for basic layouts. The project directory is here:
    C:\QT5\Examples\Qt-5.12.0\widgets\layouts\basiclayouts
    This line is flagged
    #include <QApplication>
    And the error QApplication not found.
    I surmise there is a fundamental setup step to perform that I missed. Please advise me of where to find it.

    Please post screenshots of:

    • The screen which shows you the "QApplication not found" message
    • Tools > Options... > Kits > Kits
    • Tools > Options... > Kits > Qt Versions

    @BKBK said in QT Creator cannot find <Qdialog> in Windows 10:

    As I follow the Get Started thread of the creator I want the ability to separate that text and guidance from the creator so I can see it while I create the project. One on each monitor.

    Try the Window > Open in New Window menu item

    When selecting the components, please shown the total amount of data to be downloaded for each.

    It does, doesn't it? The 2nd screenshot at https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI shows:

    Qt 5.11.0 Prebuilt Components for MinGW 5.3.0 32-bit

    This component will occupy approximately 3.64 GB on your hard disk drive.

    edit: the point of the image is, in part: The dialog will not allow any editing in field Library:, field Include path contains a path, yet button Next is disabled. Please provide some information as to why the Next button is disabled.

    This dialog is for adding 3rd-party libraries. Most Qt applications don't need it.

    For now, let's focus on your main issue (the inability to build example projects) -- please provide the screenshots requested above. I'll answer your questions about the Add Library dialog after that's resolved.



  • There is something, make that, there are a few things that are probably here but I am missing. This is a weekend and most developers have better things to do so I am going to split this into two threads.
    First, I answer the immediate questions posed about why Creator will not build the example project.
    After posting that, I have a suspicion that it might not like installing in directory QT5 rathner than just QT so I will uninstall and perform the same install to the true default directory C:\QT.
    To the first part, I am not able to build the example program. Here are the steps.
    Note that I was ready to change virus detection app to Bit Defender and currently have no protection application installed.

    1. Start QT Creator, click Example, scroll down to what looks like the most simple example, Basic Layouts and click it. A new window is opened

    Side note: I must capture each image again and save it to a file to insert here.
    0_1544374145971_pic 1.JPG

    The goal is to simply run an example so click Running the Example
    0_1544374376905_pic 2.JPG

    From the dialog, …open the Welcome mode …
    That is how I arrived here, circular, but understandable.
    Click Building and Running an Example and am rewarded with web page: http://doc.qt.io/qtcreator/creator-build-example-application.html
    It starts over. Repeat steps 1 and 2.
    This time the code is displayed, the main app.
    The first line if code is flagged as an error. It’s a mouse hover display so the display cannot be captured.
    Look across the bottom to see what is in the various items there. Compile Output is empty.
    General Messages contains this text:

    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    Could not find qmake spec 'default'.
    Error while parsing file C:\QT5\Examples\Qt->5.12.0\widgets\layouts\basiclayouts\basiclayouts.pro. Giving up.

    The others are empty except search results which is a blank search form.

    Return to the web page for step 3:
    …, click the Kit Selector and select a kit for the device.
    After checking all the menu items the best fit is: Build -> Open Build and Run Kit Selector
    Click that to be rewarded with a popup in the lower left corner. When the snipping tool is clicked the popup closes prohibiting capture. The text is:

    The project basiclayouts is not yet configured.
    You can configure it in the Projects Mode

    Click that link: Projects Mode to get here:
    0_1544374513679_pic 3.JPG

    In the main panel: Configure Project, as a novice Creator users, I don’t know what to enter in the field: Type to filter kits by name.
    Try the top down Import Build from to get the path
    C:\QT5\Examples\Qt-5.12.0\widgets\layouts
    0_1544374581204_pic 4.JPG

    Click the wide pushbutton Import. No response. The button Configure Project is disabled.
    Go to the left panel and select Manage Kits and the reward is the Options dialog.

    0_1544374640719_pic 5.JPG

    This novice is quite unsure of what to do.
    As the basic path is to configure kits, go that way.
    The Auto-detected looks good. The down arrow only closes it.
    There are two options available: the Add button and the OK button.
    I presume ( I presume you understand the word presume, grin.) the dialog is correctly configured and select OK.
    The window closes with no apparent action taken.

    I presume, but only because there is little other choice, that the proper activity was completed. I do suspect that is not the case.

    Next step is a guess. The dialog to Manage Kits was taken and apparently completed so click Build.
    The only option enabled is:
    Build -> Open Build and Run Kit Selector

    That is circular. That’s enough here. This will require quite a bit of time to edit into a response.
    I stop here to uninstall and re-install with the default location unchanged.
    Should I back up to a previous version or use the same version. I suspect that the previous version has a higher probability of success, but that is changing two variables in one step. I will stay with the latest version.


  • Moderators

    @BKBK said in QT Creator cannot find <Qdialog> in Windows 10:

    0_1544374581204_pic 4.JPG

    The key is this: "No valid kits found".

    We need to find out what's missing in your kits configuration.

    0_1544374640719_pic 5.JPG

    1. Click on Desktop Qt 5.12.0 MSVC2017 64-bit in your screenshot to reveal the detailed properties. Post a screenshot.
    2. Mouse-over the 2 yellow exclamation marks in your screenshot. Post the exact pop-up messages.
    3. Post a screenshot of the Qt versions tab.

  • Moderators

    OK, root cause found: https://forum.qt.io/topic/97455/qt-install-fourth-attempt

    Qt Creator needs to find your installation of MSVC 2017.

    Let's continue the discussion in the other thread. I'm locking this one to help focus on troubleshooting.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.