[SOLVED]undefined reference to QBasicAtomicInt
-
I can compile my Qt project in Terminal bash but I'm having problems compiling with Qt Creator. here are some issue I've encounter:
make: Entering directory
/home/esn/SQSP/qespta' g++ -Wl,-rpath,/comp/qtb/lib -o qespta main.o MainWindow.o MessageWindow.o QespTest.o qextserialport.o qextserialenumerator.o qextserialport_unix.o qextserialenumerator_linux.o moc_MainWindow.o moc_MessageWindow.o moc_QespTest.o -L/comp/qtb/lib -lQtGui -L/comp/qtb/lib -L/usr/X11R6/lib -lQtCore -lpthread MainWindow.o: In function
QString::~QString()':
/comp/qtb/include/QtCore/qstring.h:880: undefined reference toQBasicAtomicInt::deref()' MessageWindow.o: In function
QByteArray::~QByteArray()':
/comp/qtb/include/QtCore/qbytearray.h:401: undefined reference toQBasicAtomicInt::deref()' MessageWindow.o: In function
QString::QString(QString const&)':
/comp/qtb/include/QtCore/qstring.h:726: undefined reference toQBasicAtomicInt::ref()' MessageWindow.o: In function
QString::QString()':
/comp/qtb/include/QtCore/qstring.h:879: undefined reference toQBasicAtomicInt::ref()' qextserialport.o: In function
QByteArray::QByteArray()':
/comp/qtb/include/QtCore/qbytearray.h:400: undefined reference toQBasicAtomicInt::ref()' qextserialenumerator_linux.o: In function
QList<QString>::QList()':
/comp/qtb/include/QtCore/qlist.h:121: undefined reference toQBasicAtomicInt::ref()' qextserialenumerator_linux.o: In function
QList<QString>::~QList()':
/comp/qtb/include/QtCore/qlist.h:731: undefined reference toQBasicAtomicInt::deref()' qextserialenumerator_linux.o: In function
QList<QString>::QList(QList<QString> const&)':
/comp/qtb/include/QtCore/qlist.h:122: undefined reference toQBasicAtomicInt::ref()' qextserialenumerator_linux.o: In function
QList<QextPortInfo>::QList()':
/comp/qtb/include/QtCore/qlist.h:121: undefined reference toQBasicAtomicInt::ref()' qextserialenumerator_linux.o: In function
QList<QextPortInfo>::~QList()':
/comp/qtb/include/QtCore/qlist.h:731: undefined reference toQBasicAtomicInt::deref()' qextserialenumerator_linux.o: In function
QList<QString>::operator=(QList<QString> const&)':
/comp/qtb/include/QtCore/qlist.h:441: undefined reference toQBasicAtomicInt::ref()' /comp/qtb/include/QtCore/qlist.h:442: undefined reference to
QBasicAtomicInt::deref()'
qextserialenumerator_linux.o: In functionQList<QString>::detach_helper_grow(int, int)': /comp/qtb/include/QtCore/qlist.h:699: undefined reference to
QBasicAtomicInt::deref()'
qextserialenumerator_linux.o: In functionQList<QextPortInfo>::detach_helper_grow(int, int)': /comp/qtb/include/QtCore/qlist.h:699: undefined reference to
QBasicAtomicInt::deref()'
qextserialenumerator_linux.o: In functionQList<QString>::detach_helper(int)': /comp/qtb/include/QtCore/qlist.h:718: undefined reference to
QBasicAtomicInt::deref()'
collect2: error: ld returned 1 exit status
make: Leaving directory `/home/esn/SQSP/qespta'
make: *** [qespta] Error 1
11:08:17: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project qespta (target: Qt 4.8.4 Comp(qts)2)
When executing step 'Make'Please help me to solve this problem. thanks
-
If it compiles in terminal but not in QtCreator I would recommend comparing compile output from terminal and QtCreator (you have copy-paster latter here). Maybe you are using different Qt version in terminal and QtCreator. I believe QtCreator puts output to specific location (vs. compiling locally in terminal) - maybe cleaning up QtCreator output is all you need.
QBasicAtomicInt::deref() is part of QtCore and I see it included in linked library list (-lQtCore). As well I don't see compilation stage in your copy-paste only linking. Therefore I tend to believe that compilation stage was done with different Qt version.
-
Ahhh... Actually, my operating system crashes last time. and I've just restored my operating system to it's previous working state and it actually solved my problem. thanks again daliusd. :)