what is the meaning of "qrc::-1 File is empty"
-
I'm trying to learn qt and I encountered such an error in my project, but I couldn't find any examples. Can you help?
QmlApplicationEngine failed to load component
qrc::-1 File is emptymy code at main.cpp
#include <QGuiApplication>
#include <QtQml/QQmlApplicationEngine>int main(int argc, char *argv[]){
QGuiApplication app(argc,argv);
QQmlApplicationEngine engine;
engine.load(QUrl("qrc://main.qml"));
return app.exec();
}my code at main.qml
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Window 2.0ApplicationWindow{
width: 640
height: 480
visible: trueText{ anchors.centerIn: parent text: "hello world" }
}
-
@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Hello and welcome to Qt forum!
engine.load(QUrl("qrc://main.qml"));
With this, you want to read
main.qml
file from resources (cf. https://doc.qt.io/archives/qt-5.11/resources.html).
Do you have add a resources to your project?
Is this file part of this resource? -
@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Yes ı created and added the file "main.qml".
And is the resource part of your project?
Do you use cmake or qmake build system?
Which Qt version are you using (I mean Qt and not QtCreator)?