QtCreator cannot build main.qml file, an example qml from a book!
-
U:\Users\Juan Dent\Qt\with QtCreator\build-QtQuickApp-Desktop_Qt_6_6_2_MSVC2019_64bit-Debug_deps\ds-build\src\imports\tools\eventsimulator\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp:-1: error: C1083: Cannot open compiler generated file: '': Invalid argument
:-1: error: ninja: build stopped: subcommand failed.What is wrong?
-
What is wrong?
Please show the main.qml file here. Without some more information, it's hard to say. Could be anything from a broken compile kit, wrong Qt version, broken example from the book.
-
This post is deleted!
-
@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
-
@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. -
I have some kits with warnings but that should not matter because I am using the default Desktop kit correct?
-
@jdent The broken ones are your Android kits. But I reckon, you want to compile for Windows?
That should work.
Please do a freshconfigure
andninja
from the command line.
What does it say? -
@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 ?
-
@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.bat
is in your source tree. -
@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-fuzzand configure is a batch file in U:\Qt\6.6.2\Src
Is it safe to run these files?
-
@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. -
@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.
-
@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!
-
@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()