Need help in solving the undefined reference error for qt5
-
Hi All
I am trying to run a code with the QT5 library
I have the following code#include <QtWidgets/QWidget>
2 #include <QtWidgets/QApplication>
3 #include <QtWidgets/QPushButton>
4 int main(int argc, char *argv[])
5 {
6 QApplication app(argc, argv);
7
8 QPushButton hello("Hello world!");
9 hello.resize(100, 30);
10
11 hello.show();
12 return app.exec();
13 }
~
I have a following .pro file and######################################################################
Automatically generated by qmake (3.1) Thu Oct 11 10:04:00 2018
######################################################################
TEMPLATE = app
TARGET = Qt_Examples
INCLUDEPATH += .
QT += core gui
@QT += widgets@The following define makes your compiler warn you if you use any
feature of Qt which has been marked as deprecated (the exact warnings
depend on your compiler). Please consult the documentation of the
deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
following is .pro fileYou can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
Input
SOURCES += main.cpp
~I am getting following e
undefined reference to
QWidget::show()' main.o:(.qtversion[qt_version_tag]+0x0): undefined reference to
qt_version_tag'
main.o: In functionQTypedArrayData<unsigned short>::deallocate(QArrayData*)': qt594_20180627/debug/linux_x86_64/include/QtCore/qarraydata.h:237: undefined reference to
QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
collect2: error: ld returned 1 exit status -
Hi
If you make a empty default GUI project , does that run ?
How did you install Qt5 ? -
What is empty default project can u please elaborate
-
Yes I did . Any hints to solve the problem
-
Hi, perhaps there's a problem because this is not a Qt5 program, it's at least [10 years old example](https://doc.qt.io/archives/4.3/tutorial-t1.html
You could try what @mrjj suggests: start Qt Creator, select File, New File or Project, select Application, select Qt Widgets Application, don't change anything, just try to run it.
-
I am running in linux and do not have a Qt Creator. COuld you generate a code for me for Empty Gui Project that I can resue in QMake in linux
-
which version of Qt creator is compatible with Qt5