The Hello World Example

Hi everyone,
I have a pretty beginner question regarding the development of an extension for Avogadro. I am trying to build the Hello World extension given as a example but I face this error:

Undefined symbols for architecture x86_64:
“qFree(void*)”, referenced from:
QList<QAction*>::detach_helper(int) in helloworldextension.cpp.o
QList<QAction*>::free(QListData::Data*) in helloworldextension.cpp.o
QList<QAction*>::detach_helper_grow(int, int) in helloworldextension.cpp.o
"QBoxLayout::addLayout(QLayout*, int)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QBoxLayout::addWidget(QWidget*, int, QFlagsQt::AlignmentFlag)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QGridLayout::addLayout(QLayout*, int, int, int, int, QFlagsQt::AlignmentFlag)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QGridLayout::QGridLayout(QWidget*)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QHBoxLayout::QHBoxLayout()", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QLayoutItem::~QLayoutItem()", referenced from:
QSpacerItem::QSpacerItem(int, int, QSizePolicy::Policy, QSizePolicy::Policy) in helloworlddialog.cpp.o
"QMetaObject::changeGuard(QObject**, QObject*)", referenced from:
QPointer::operator=(QObject*) in helloworldextension.cpp.o
"QMetaObject::removeGuard(QObject**)", referenced from:
QPointer::~QPointer() in helloworldextension.cpp.o
"QMetaObject::connectSlotsByName(QObject*)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QPushButton::QPushButton(QWidget*)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QVBoxLayout::QVBoxLayout()", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QAbstractButton::setText(QString const&)", referenced from:
Ui_HelloWorldDialog::retranslateUi(QDialog*) in helloworlddialog.cpp.o
"QCoreApplication::translate(char const*, char const*, char const*, QCoreApplication::Encoding)", referenced from:
Ui_HelloWorldDialog::retranslateUi(QDialog*) in helloworlddialog.cpp.o
"QChar::fromAscii(char)", referenced from:
operator+(QString const&, char) in helloworldextension.cpp.o
"QLabel::setAlignment(QFlagsQt::AlignmentFlag)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QLabel::setText(QString const&)", referenced from:
Ui_HelloWorldDialog::retranslateUi(QDialog*) in helloworlddialog.cpp.o
"QLabel::QLabel(QWidget*, QFlagsQt::WindowType)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QAction::setText(QString const&)", referenced from:
HelloWorld::HelloWorldExtension::HelloWorldExtension(QObject*) in helloworldextension.cpp.o
"QAction::QAction(QObject*)", referenced from:
HelloWorld::HelloWorldExtension::HelloWorldExtension(QObject*) in helloworldextension.cpp.o
"QDialog::closeEvent(QCloseEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::setVisible(bool)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::eventFilter(QObject*, QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::qt_metacall(QMetaObject::Call, int, void**)", referenced from:
HelloWorld::HelloWorldDialog::qt_metacall(QMetaObject::Call, int, void**) in helloworlddialog.cpp.o
"QDialog::qt_metacast(char const*)", referenced from:
HelloWorld::HelloWorldDialog::qt_metacast(char const*) in helloworlddialog.cpp.o
"QDialog::resizeEvent(QResizeEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::keyPressEvent(QKeyEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::contextMenuEvent(QContextMenuEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::staticMetaObject", referenced from:
HelloWorld::HelloWorldDialog::staticMetaObject in helloworlddialog.cpp.o
"QDialog::done(int)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::accept()", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::reject()", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::showEvent(QShowEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::QDialog(QWidget*, QFlagsQt::WindowType)", referenced from:
HelloWorld::HelloWorldDialog::HelloWorldDialog(QWidget*, QFlagsQt::WindowType) in helloworlddialog.cpp.o
"QDialog::~QDialog()", referenced from:
HelloWorld::HelloWorldDialog::HelloWorldDialog(QWidget*, QFlagsQt::WindowType) in helloworlddialog.cpp.o
HelloWorld::HelloWorldDialog::~HelloWorldDialog() in helloworlddialog.cpp.o
"QObject::childEvent(QChildEvent*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::timerEvent(QTimerEvent*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::customEvent(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::eventFilter(QObject*, QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
"QObject::qt_metacall(QMetaObject::Call, int, void**)", referenced from:
HelloWorld::HelloWorldExtensionFactory::qt_metacall(QMetaObject::Call, int, void**) in helloworldextension.cpp.o
"QObject::qt_metacast(char const*)", referenced from:
HelloWorld::HelloWorldExtensionFactory::qt_metacast(char const*) in helloworldextension.cpp.o
"QObject::connectNotify(char const*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::setObjectName(QString const&)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QObject::disconnectNotify(char const*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::staticMetaObject", referenced from:
HelloWorld::HelloWorldExtensionFactory::staticMetaObject in helloworldextension.cpp.o
"QObject::event(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldExtension in helloworldextension.cpp.o
vtable for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
"QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType)", referenced from:
HelloWorld::HelloWorldDialog::HelloWorldDialog(QWidget*, QFlagsQt::WindowType) in helloworlddialog.cpp.o
"QObject::QObject(QObject*)", referenced from:
HelloWorld::HelloWorldExtensionFactory::HelloWorldExtensionFactory() in helloworldextension.cpp.o
"QObject::~QObject()", referenced from:
HelloWorld::HelloWorldExtensionFactory::~HelloWorldExtensionFactory() in helloworldextension.cpp.o
"QString::fromAscii_helper(char const*, int)", referenced from:
QString::QString(char const*) in helloworldextension.cpp.o
"QString::free(QString::Data*)", referenced from:
QString::~QString() in helloworldextension.cpp.o
QString::~QString() in helloworlddialog.cpp.o
"QString::grow(int)", referenced from:
QString::operator+=(QChar) in helloworldextension.cpp.o
"QString::append(QString const&)", referenced from:
QString::operator+=(QString const&) in helloworldextension.cpp.o
"QString::realloc(int)", referenced from:
QString::operator+=(QChar) in helloworldextension.cpp.o
"QString::fromUtf8(char const*, int)", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QWidget::enterEvent(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::fontChange(QFont const&)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::leaveEvent(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::paintEvent(QPaintEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::wheelEvent(QWheelEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::actionEvent(QActionEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::changeEvent(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::styleChange(QStyle&)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::tabletEvent(QTabletEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::focusInEvent(QFocusEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::dragMoveEvent(QDragMoveEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::enabledChange(bool)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::focusOutEvent(QFocusEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::paletteChange(QPalette const&)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::dragEnterEvent(QDragEnterEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::dragLeaveEvent(QDragLeaveEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::languageChange()", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::mouseMoveEvent(QMouseEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::setWindowTitle(QString const&)", referenced from:
Ui_HelloWorldDialog::retranslateUi(QDialog*) in helloworlddialog.cpp.o
"QWidget::keyReleaseEvent(QKeyEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::mousePressEvent(QMouseEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::inputMethodEvent(QInputMethodEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::mouseReleaseEvent(QMouseEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::focusNextPrevChild(bool)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::mouseDoubleClickEvent(QMouseEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::windowActivationChange(bool)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::event(QEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::resize(QSize const&)", referenced from:
QWidget::resize(int, int) in helloworlddialog.cpp.o
"QWidget::macEvent(OpaqueEventHandlerCallRef*, OpaqueEventRef*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::dropEvent(QDropEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::hideEvent(QHideEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::moveEvent(QMoveEvent*)", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QListData::detach_grow(int*, int)", referenced from:
QList<QAction*>::detach_helper_grow(int, int) in helloworldextension.cpp.o
"QListData::shared_null", referenced from:
QList<QAction*>::QList() in helloworldextension.cpp.o
"QListData::append()", referenced from:
QList<QAction*>::append(QAction* const&) in helloworldextension.cpp.o
"QListData::detach(int)", referenced from:
QList<QAction*>::detach_helper(int) in helloworldextension.cpp.o
"QMetaObject::tr(char const*, char const*) const", referenced from:
HelloWorld::HelloWorldExtension::tr(char const*, char const*) in helloworldextension.cpp.o
"QDialog::minimumSizeHint() const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QDialog::sizeHint() const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QObject::objectName() const", referenced from:
Ui_HelloWorldDialog::setupUi(QDialog*) in helloworlddialog.cpp.o
"QWidget::paintEngine() const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::heightForWidth(int) const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::inputMethodQuery(Qt::InputMethodQuery) const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::metric(QPaintDevice::PaintDeviceMetric) const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"QWidget::devType() const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"typeinfo for QDialog", referenced from:
typeinfo for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"typeinfo for QObject", referenced from:
typeinfo for HelloWorld::HelloWorldExtensionFactory in helloworldextension.cpp.o
"vtable for QLayoutItem", referenced from:
QLayoutItem::QLayoutItem(QFlagsQt::AlignmentFlag) in helloworlddialog.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
“vtable for QSpacerItem”, referenced from:
QSpacerItem::QSpacerItem(int, int, QSizePolicy::Policy, QSizePolicy::Policy) in helloworlddialog.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
“non-virtual thunk to QWidget::paintEngine() const”, referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"non-virtual thunk to QWidget::metric(QPaintDevice::PaintDeviceMetric) const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
"non-virtual thunk to QWidget::devType() const", referenced from:
vtable for HelloWorld::HelloWorldDialog in helloworlddialog.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [helloworldextension.dylib] Error 1
make[1]: *** [CMakeFiles/helloworldextension.dir/all] Error 2
make: *** [all] Error 2

I am pretty sure it is a question of library, but I don’t know how to fix it. I am on mac os 10.7.5. Thank you for your help.

Marc

On Tue, Nov 20, 2012 at 8:25 AM, Dubois Marc-André
ma.dubois@umontreal.ca wrote:

Hi everyone,
I have a pretty beginner question regarding the development of an extension for Avogadro. I am trying to build the Hello World extension given as a example but I face this error:

Undefined symbols for architecture x86_64:
“qFree(void*)”, referenced from:
QList<QAction*>::detach_helper(int) in helloworldextension.cpp.o

I am pretty sure it is a question of library, but I don’t know how to fix it. I am on mac os 10.7.5. Thank you for your help.

It’s having troubling linking the Qt libraries. These errors mean that
the compiler is finding the Qt headers, but cannot locate an
appropriate library to define the symbols in the headers.

Check that the qt libraries are being linked in (run "make VERBOSE=1"
to see the actual compilation/linking commands).

Hope this helps,
Dave