Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator cannot build main.qml file, an example qml from a book!

QtCreator cannot build main.qml file, an example qml from a book!

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qtcreator12
17 Posts 4 Posters 1.5k 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.
  • J jdent
    10 Mar 2024, 12:29

    @jdent the main.qml is

    /* This file is generated and only relevant for integrating the project into a Qt 6 and cmake based
    C++ project. */
    import QtQuick
    import QtQuick.Controls
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello QML")
    
        menuBar: MenuBar {
            Menu {
                title: qsTr("File")
                MenuItem {
                    text: qsTr("Exit")
                    shortCut: "Ctrl+Q"
                    onTriggered: Qt.quit()
                }
            }
        }
    
        Text {
            id: hw
            text: qsTr("Hello World")
            font.capitalization: Font.AllUppercase
            anchors.centerIn: parent
        }
    
        Label {
            anchors { bottom: hw.top; bottomMargin: 5; horizontalCenter: hw.horizontalCenter }
            text: qsTr("Hello Qt Quick")
        }
    }
    

    And the kit I believe its broken

    J Offline
    J Offline
    jdent
    wrote on 10 Mar 2024, 13:51 last edited by
    #6

    @jdent I don't know the version of the QtQuick and QtQuick.Controls - I installed 6.6.2. where can I find the version? Could that be the culprit?

    D 1 Reply Last reply 10 Mar 2024, 14:00
    0
    • J jdent
      10 Mar 2024, 13:51

      @jdent I don't know the version of the QtQuick and QtQuick.Controls - I installed 6.6.2. where can I find the version? Could that be the culprit?

      D Offline
      D Offline
      DeepakVishak
      wrote on 10 Mar 2024, 14:00 last edited by
      #7

      @jdent
      Hi Jdnet,

      Did you try to look at general messages tab. If you have no sufficient information on issues tab you can find it on general messages maybe you can find the exact issue over there.

      A 1 Reply Last reply 10 Mar 2024, 14:45
      0
      • D DeepakVishak
        10 Mar 2024, 14:00

        @jdent
        Hi Jdnet,

        Did you try to look at general messages tab. If you have no sufficient information on issues tab you can find it on general messages maybe you can find the exact issue over there.

        A Offline
        A Offline
        Axel Spoerl
        Moderators
        wrote on 10 Mar 2024, 14:45 last edited by
        #8

        @jdent
        If you believe your kit is broken, there should be a warning / error icon in front of the kit name in Creator. If you hover over this icon, you will get the reason for the error / warning.

        Software Engineer
        The Qt Company, Oslo

        J 1 Reply Last reply 10 Mar 2024, 15:04
        0
        • A Axel Spoerl
          10 Mar 2024, 14:45

          @jdent
          If you believe your kit is broken, there should be a warning / error icon in front of the kit name in Creator. If you hover over this icon, you will get the reason for the error / warning.

          J Offline
          J Offline
          jdent
          wrote on 10 Mar 2024, 15:04 last edited by
          #9

          @Axel-Spoerl kits.png

          I have some kits with warnings but that should not matter because I am using the default Desktop kit correct?

          A 1 Reply Last reply 10 Mar 2024, 15:08
          0
          • J jdent
            10 Mar 2024, 15:04

            @Axel-Spoerl kits.png

            I have some kits with warnings but that should not matter because I am using the default Desktop kit correct?

            A Offline
            A Offline
            Axel Spoerl
            Moderators
            wrote on 10 Mar 2024, 15:08 last edited by
            #10

            @jdent The broken ones are your Android kits. But I reckon, you want to compile for Windows?
            That should work.
            Please do a fresh configureand ninjafrom the command line.
            What does it say?

            Software Engineer
            The Qt Company, Oslo

            J 1 Reply Last reply 10 Mar 2024, 15:18
            0
            • A Axel Spoerl
              10 Mar 2024, 15:08

              @jdent The broken ones are your Android kits. But I reckon, you want to compile for Windows?
              That should work.
              Please do a fresh configureand ninjafrom the command line.
              What does it say?

              J Offline
              J Offline
              jdent
              wrote on 10 Mar 2024, 15:18 last edited by
              #11

              @Axel-Spoerl you mean like this:

              U:\Qt\Tools\Ninja>ninja
              ninja: error: loading 'build.ninja': The system cannot find the file specified.

              where is configure.exe ?

              A 1 Reply Last reply 10 Mar 2024, 17:24
              0
              • J jdent
                10 Mar 2024, 15:18

                @Axel-Spoerl you mean like this:

                U:\Qt\Tools\Ninja>ninja
                ninja: error: loading 'build.ninja': The system cannot find the file specified.

                where is configure.exe ?

                A Offline
                A Offline
                Axel Spoerl
                Moderators
                wrote on 10 Mar 2024, 17:24 last edited by
                #12

                @jdent
                Well, that's a path issue.
                You have to configure the PATH environment variable in your system settings and make it point to the ninja executable in the Qt installation tree.
                Same is needed for CMake.

                configure.batis in your source tree.

                Software Engineer
                The Qt Company, Oslo

                J 1 Reply Last reply 10 Mar 2024, 19:51
                0
                • A Axel Spoerl
                  10 Mar 2024, 17:24

                  @jdent
                  Well, that's a path issue.
                  You have to configure the PATH environment variable in your system settings and make it point to the ninja executable in the Qt installation tree.
                  Same is needed for CMake.

                  configure.batis in your source tree.

                  J Offline
                  J Offline
                  jdent
                  wrote on 10 Mar 2024, 19:51 last edited by
                  #13

                  @Axel-Spoerl I set the PATH environment to point to Ninja.exe, and now I can run Ninja anywhere. But where should I run it from?
                  The only folder with build.ninja is in U:\Qt\6.6.2\Src\qtwebengine\src\3rdparty\chromium\tools\memory\partition_allocator\palloc_viewer
                  and
                  U:\Qt\6.6.2\Src\qtwebengine\src\3rdparty\ninja\misc\afl-fuzz

                  and configure is a batch file in U:\Qt\6.6.2\Src

                  Is it safe to run these files?

                  A 1 Reply Last reply 10 Mar 2024, 20:38
                  0
                  • J jdent
                    10 Mar 2024, 19:51

                    @Axel-Spoerl I set the PATH environment to point to Ninja.exe, and now I can run Ninja anywhere. But where should I run it from?
                    The only folder with build.ninja is in U:\Qt\6.6.2\Src\qtwebengine\src\3rdparty\chromium\tools\memory\partition_allocator\palloc_viewer
                    and
                    U:\Qt\6.6.2\Src\qtwebengine\src\3rdparty\ninja\misc\afl-fuzz

                    and configure is a batch file in U:\Qt\6.6.2\Src

                    Is it safe to run these files?

                    A Offline
                    A Offline
                    Axel Spoerl
                    Moderators
                    wrote on 10 Mar 2024, 20:38 last edited by
                    #14

                    @jdent
                    If build.ninja isn’t found, configure hasn’t been run or hasn’t finished properly. I’ll not say whether configure.bat is safe on your system. If you have cloned Qt from a recent, safe source and not made any modifications, it should be.

                    Software Engineer
                    The Qt Company, Oslo

                    C 1 Reply Last reply 11 Mar 2024, 10:25
                    0
                    • A Axel Spoerl
                      10 Mar 2024, 20:38

                      @jdent
                      If build.ninja isn’t found, configure hasn’t been run or hasn’t finished properly. I’ll not say whether configure.bat is safe on your system. If you have cloned Qt from a recent, safe source and not made any modifications, it should be.

                      C Online
                      C Online
                      cristian-adam
                      wrote on 11 Mar 2024, 10:25 last edited by
                      #15

                      @Axel-Spoerl I don't think @jdent wants to build Qt here.

                      It' that his Qt example doesn't compile with his setup.

                      @jdent can you try a shorter path for your example? There are issues on Windows with Qt Design Studio projects and long project paths.

                      J 1 Reply Last reply 11 Mar 2024, 18:24
                      0
                      • C cristian-adam
                        11 Mar 2024, 10:25

                        @Axel-Spoerl I don't think @jdent wants to build Qt here.

                        It' that his Qt example doesn't compile with his setup.

                        @jdent can you try a shorter path for your example? There are issues on Windows with Qt Design Studio projects and long project paths.

                        J Offline
                        J Offline
                        jdent
                        wrote on 11 Mar 2024, 18:24 last edited by
                        #16

                        @cristian-adam My path is already small since QT root is at U:\Qt
                        How would I move the example to a shorter directory?

                        You are correct I am not building source but an example

                        Please help!

                        C 1 Reply Last reply 12 Mar 2024, 11:22
                        0
                        • J jdent
                          11 Mar 2024, 18:24

                          @cristian-adam My path is already small since QT root is at U:\Qt
                          How would I move the example to a shorter directory?

                          You are correct I am not building source but an example

                          Please help!

                          C Online
                          C Online
                          cristian-adam
                          wrote on 12 Mar 2024, 11:22 last edited by
                          #17

                          @jdent U:\Users\Juan Dent\Qt\with QtCreator\build-QtQuickApp-Desktop_Qt_6_6_2_MSVC2019_64bit-Debug_deps is a bit long.

                          Have a look at https://bugreports.qt.io/browse/QTBUG-117413
                          and if you are building a Qt Design Studio project change the corresponding CMake code like this:

                          if (BUILD_QDS_COMPONENTS)
                              if (WIN32)
                                  set(FETCHCONTENT_BASE_DIR $ENV{HOMEDRIVE}/bld/qds-deps) # <---- new line
                              endif()
                              include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents)
                          endif() 
                          
                          1 Reply Last reply
                          0

                          15/17

                          11 Mar 2024, 10:25

                          • Login

                          • Login or register to search.
                          15 out of 17
                          • First post
                            15/17
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved