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!
Forum Updated to NodeBB v4.3 + New Features

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.7k Views 1 Watching
  • 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

    This post is deleted!

    J Offline
    J Offline
    jdent
    wrote on last edited by
    #4

    @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 2 Replies Last reply
    0
    • J jdent

      @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 last edited by jdent
      #5

      @jdent The build settings has the CMAKE_GENERATOR as Ninja and it appears as red ; I don't know what it should be??

      1 Reply Last reply
      0
      • J jdent

        @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 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
        0
        • J jdent

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

          Axel SpoerlA 1 Reply Last reply
          0
          • D DeepakVishak

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

            Axel SpoerlA Offline
            Axel SpoerlA Offline
            Axel Spoerl
            Moderators
            wrote on 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
            0
            • Axel SpoerlA Axel Spoerl

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

              Axel SpoerlA 1 Reply Last reply
              0
              • J jdent

                @Axel-Spoerl kits.png

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

                Axel SpoerlA Offline
                Axel SpoerlA Offline
                Axel Spoerl
                Moderators
                wrote on 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
                0
                • Axel SpoerlA Axel Spoerl

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

                  Axel SpoerlA 1 Reply Last reply
                  0
                  • J jdent

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

                    Axel SpoerlA Offline
                    Axel SpoerlA Offline
                    Axel Spoerl
                    Moderators
                    wrote on 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
                    0
                    • Axel SpoerlA Axel Spoerl

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

                      Axel SpoerlA 1 Reply Last reply
                      0
                      • J jdent

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

                        Axel SpoerlA Offline
                        Axel SpoerlA Offline
                        Axel Spoerl
                        Moderators
                        wrote on 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

                        cristian-adamC 1 Reply Last reply
                        0
                        • Axel SpoerlA Axel Spoerl

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

                          cristian-adamC Offline
                          cristian-adamC Offline
                          cristian-adam
                          wrote on 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
                          0
                          • cristian-adamC cristian-adam

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

                            cristian-adamC 1 Reply Last reply
                            0
                            • J jdent

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

                              cristian-adamC Offline
                              cristian-adamC Offline
                              cristian-adam
                              wrote on 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

                              • Login

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