Mac: Undefined symbols for x86_64 architecture: "QApplication :: palette ()" referenced by:
I am getting the following linker error while compiling our Qt project. We are not using qmake. We use autoconf and automake .. Now porting to Mac leads to the following error: I tried using the Qt-SDK and compiled Qt myself ... Nothing worked :(
Maybe someone has an idea?
/bin/sh ../../libtool --tag=CXX --mode=link clang++ -g -O2 -Wl,-rpath -
Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o ../../atcaf/atcafgui/libatcafgui.la
libtool: link: clang++ -g -O2 -Wl,-rpath -Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o -Wl,-bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a -L/usr/local/Qt-5.0.1/lib /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib -L/space/dev-libs/log4cxx-dfs/lib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -L/usr/lib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -L/space/dev-libs/boost_1_53/lib -lboost_python -lpython2.6 -L/space/dev-libs/instantclient_10_2 -lclntsh -lz
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.7.4 -o showtime -lcrt1.10.6.o -L/usr/local/Qt-5.0.1/lib -L/space/dev-libs/log4cxx-dfs/lib -L/usr/lib -L/space/dev-libs/boost_1_53/lib -L/space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/boost_1_53/lib showtime-application_resources.o showtime-main.o cmdline.o -bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -lboost_python -lpython2.6 -lclntsh -lz -lstdc++ -lSystem /usr/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"QApplication::palette()", referenced from:
_main in showtime-main.o
"QApplication::commitData(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QApplication::saveState(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QAbstractItemView::dataChanged(QModelIndex const&, QModelIndex const&)", referenced from:
vtable for LogTableWWU in libatcafgui.a(libatcafgui_la-moc_LogTableWWU.o)
"QWidget::styleChange(QStyle&)", referenced from:
source to share
I had a similar problem when porting from Qt 4 to Qt 5. There were missing functions for QApplication::commitData()
and QApplication::saveState()
.
I got the class from QApplication
, in the header file I changed
#include <QtGui/QApplication>
to
#include <QApplication>
and that solved the problem.
source to share
I had the same problem, although mine was related to QWidget functions (e.g. QWidget :: styleChange (QStyle &) or QWidget :: fontChange (QFont const &)) and not QApplication.
As suggested by koan I searched for all occurrences
#include <QtGui/
in my project and replaced them with
#include <
which solved the problem. I've tested this with both clang and g ++ versions (5.0.1 and 5.0.2) and both work.
Note:
A number of solutions found online suggested adding
QT += widgets
to the qmake project file (.pro) as it might be related to an existing error. While I don't think adding this is a problem, it didn't solve this particular problem.
source to share