How to convert QGuiApplication to QApplication ?
-
I'm trying to use
PolarChartView
in Qt6 and writing the code in qt creator 10 but when I run my code , the application crashes and the console log says it just crashed. I figured out that I have to changeQGuiApplication
toQApplication
and I made these configurations to mymain.cpp
file but I got these errors :
:-1: error: D:/CppProjects/RadarChart/main.cpp:17: undefined reference to `__imp__ZN12QApplicationD1Ev'
:-1: error: D:/CppProjects/build-radarchart-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/Debug_Desktop__9a53abaa43e654f2/radarchart.8c396ce1/3a52ce780950d4d9/main.cpp.o:D:/CppProjects/RadarChart/main.cpp:7: undefined reference to `__imp__ZN12QApplicationC1ERiPPci'
And this is my main.cpp file :
#include <QtWidgets/QApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(u"qrc:/RadarChart/Main.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
-
-
Hi,
Did you add
QT += widgets
to your.pro
file ? -
-