Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Developer
Posts: 31
Registered: ‎06-13-2014
My Device: Z30
My Carrier: Telus

Can't link to cascades library

I am trying to create and use a cascades/c++ library.  I have a number of C++/cascades classes in my application that I want to include in a separate library for re-use in other apps. The code in these classes runs fine when included directly in the application. When I create a Cascades library and move the source and header files to it, then the library appears to build correctly, but when I try to include it in the app I get the following errors.  I have followed all the instructions in the readme.txt file generated by the Cascades library wizard, and I have tried to follow some of the forum post suggestions, but nothing seems to fix the problem.  Can somebody please tell me what the problem is.

 

15:22:54 **** Incremental Build of configuration Device-Debug for project Barcode4business ****
make -j2 Device-Debug
make -C .//translations -f Makefile update
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/translations'
C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lupdate BarcodeSniffer.pro
lupdate warning: no TS files specified. Only diagnostics will be produced for 'BarcodeSniffer.pro'.
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/translations'
make -C .//translations -f Makefile release
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/translations'
C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lrelease BarcodeSniffer.pro
lrelease warning: Met no 'TRANSLATIONS' entry in project file 'BarcodeSniffer.pro'
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/translations'
make -C ./arm -f Makefile debug
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/arm'
make -f Makefile.Debug
make[2]: Entering directory `C:/momentics-workspace/Barcode4business/arm'
qcc -Vgcc_ntoarmv7le -lang-c++ -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/lib -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib/qt4/lib -o o.le-v7-g/Barcode4business o.le-v7-g/.obj/ActiveFrameQML.o o.le-v7-g/.obj/Timer.o o.le-v7-g/.obj/applicationui.o o.le-v7-g/.obj/main.o o.le-v7-g/.obj/moc_ActiveFrameQML.o o.le-v7-g/.obj/moc_Timer.o o.le-v7-g/.obj/moc_applicationui.o    -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/lib -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib/qt4/lib -LC:/bbndk/target_10_2_0_1155/qnx6//usr/lib/qt4/lib -lbb -lbbcascadesmultimedia -lbbdevice -lbbmultimedia -lbbsystem -lcamapi -lscreen -lzxing -lmmrndclient -lasound -L../assets -lBarcodeScanner -L../../DpUtilities/arm/so.le-v7-g -LC:/momentics-workspace/Barcode4business/../DpUtilities/arm/so.le-v7-g -LC:/momentics-workspace/DpUtilities/arm/a.le-v7-g -lDpUtilities -LC:/bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/lib -lQtSensors -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lsqlite3 -lz -lQtXmlPatterns -lQtGui -lQtNetwork -lsocket -lQtCore -lm -lbps
o.le-v7-g/.obj/applicationui.o: In function `~CameraScannerControl':
C:\momentics-workspace\Barcode4business\arm/../../DpUtilities/include/CameraScanner.hpp:50: undefined reference to `Scanner::~Scanner()'
C:\momentics-workspace\Barcode4business\arm/../../DpUtilities/include/CameraScanner.hpp:50: undefined reference to `vtable for CameraScannerControl'
C:\momentics-workspace\Barcode4business\arm/../../DpUtilities/include/CameraScanner.hpp:50: undefined reference to `vtable for CameraScannerControl'
o.le-v7-g/.obj/applicationui.o: In function `int qmlRegisterType<CameraScannerControl>(char const*, int, int, char const*)':
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:162: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:162: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:188: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:188: undefined reference to `CameraScannerControl::staticMetaObject'
o.le-v7-g/.obj/applicationui.o: In function `QDeclarativeElement':
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:87: undefined reference to `CameraScannerControl::CameraScannerControl(bb::cascades::Container*)'
o.le-v7-g/.obj/applicationui.o:smileysad:.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x8): undefined reference to `CameraScannerControl::metaObject() const'
o.le-v7-g/.obj/applicationui.o:smileysad:.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0xc): undefined reference to `CameraScannerControl::qt_metacast(char const*)'
o.le-v7-g/.obj/applicationui.o:smileysad:.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x10): undefined reference to `CameraScannerControl::qt_metacall(QMetaObject::Call, int, void**)'
o.le-v7-g/.obj/applicationui.o:smileysad:.rodata._ZTIN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTIN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x8): undefined reference to `typeinfo for CameraScannerControl'
cc: C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/ntoarm-ld caught signal 1
make[2]: *** [o.le-v7-g/Barcode4business] Error 1
make[2]: Leaving directory `C:/momentics-workspace/Barcode4business/arm'
make[1]: *** [debug] Error 2
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/arm'
make: *** [Device-Debug] Error 2

15:22:57 Build Finished (took 2s.950ms)

New Developer
Posts: 31
Registered: ‎06-13-2014
My Device: Z30
My Carrier: Telus

Re: Can't link to cascades library

Update:

 

I resolved the 'undefined reference to vtable' issues.  They were due to virtual destructors being defined inline instead of in the class .cpp file.  However, I am still getting 'undefined reference to `<class name>::staticMetaObject' errors during the app linking:

 

09:43:51 **** Incremental Build of configuration Device-Debug for project Barcode4business ****
make -j2 Device-Debug
make -C .//translations -f Makefile update
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/translations'
C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lupdate BarcodeSniffer.pro
lupdate warning: no TS files specified. Only diagnostics will be produced for 'BarcodeSniffer.pro'.
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/translations'
make -C .//translations -f Makefile release
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/translations'
C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lrelease BarcodeSniffer.pro
lrelease warning: Met no 'TRANSLATIONS' entry in project file 'BarcodeSniffer.pro'
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/translations'
make -C ./arm -f Makefile debug
make[1]: Entering directory `C:/momentics-workspace/Barcode4business/arm'
make -f Makefile.Debug
make[2]: Entering directory `C:/momentics-workspace/Barcode4business/arm'
qcc -Vgcc_ntoarmv7le -lang-c++ -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/lib -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib -Wl,-rpath-link,C:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib/qt4/lib -o o.le-v7-g/Barcode4business o.le-v7-g/.obj/ActiveFrameQML.o o.le-v7-g/.obj/Timer.o o.le-v7-g/.obj/applicationui.o o.le-v7-g/.obj/main.o o.le-v7-g/.obj/moc_ActiveFrameQML.o o.le-v7-g/.obj/moc_Timer.o o.le-v7-g/.obj/moc_applicationui.o    -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/lib -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib -LC:/bbndk/target_10_2_0_1155/qnx6/armle-v7/usr/lib/qt4/lib -LC:/bbndk/target_10_2_0_1155/qnx6//usr/lib/qt4/lib -lbb -lbbcascadesmultimedia -lbbdevice -lbbmultimedia -lbbsystem -lcamapi -lscreen -lzxing -lmmrndclient -lasound -L../assets -lBarcodeScanner -L../../DpUtilities/arm/so.le-v7-g -LC:/momentics-workspace/Barcode4business/../DpUtilities/arm/so.le-v7-g -LC:/momentics-workspace/DpUtilities/arm/a.le-v7-g -lDpUtilities -LC:/bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/lib -lQtSensors -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lsqlite3 -lz -lQtXmlPatterns -lQtGui -lQtNetwork -lsocket -lQtCore -lm -lbps
o.le-v7-g/.obj/applicationui.o: In function `int qmlRegisterType<CameraScannerControl>(char const*, int, int, char const*)':
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:162: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:162: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:188: undefined reference to `CameraScannerControl::staticMetaObject'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarative.h:188: undefined reference to `CameraScannerControl::staticMetaObject'
o.le-v7-g/.obj/applicationui.o: In function `QDeclarativeElement':
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:87: undefined reference to `CameraScannerControl::CameraScannerControl(bb::cascades::Container*)'
o.le-v7-g/.obj/applicationui.oSmiley Sad.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x8): undefined reference to `CameraScannerControl::metaObject() const'
o.le-v7-g/.obj/applicationui.oSmiley Sad.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0xc): undefined reference to `CameraScannerControl::qt_metacast(char const*)'
o.le-v7-g/.obj/applicationui.oSmiley Sad.rodata._ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTVN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x10): undefined reference to `CameraScannerControl::qt_metacall(QMetaObject::Call, int, void**)'
o.le-v7-g/.obj/applicationui.oSmiley Sad.rodata._ZTIN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE[_ZTIN19QDeclarativePrivate19QDeclarativeElementI20CameraScannerControlEE]+0x8): undefined reference to `typeinfo for CameraScannerControl'
o.le-v7-g/.obj/applicationui.o: In function `~QDeclarativeElement':
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:91: undefined reference to `CameraScannerControl::~CameraScannerControl()'
C:\momentics-workspace\Barcode4business\arm/../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative/qdeclarativeprivate.h:91: undefined reference to `CameraScannerControl::~CameraScannerControl()'
make[2]: Leaving directory `C:/momentics-workspace/Barcode4business/arm'
cc: C:/bbndk/host_10_2_0_15/win32/x86/usr/bin/ntoarm-ld caught signal 1
make[2]: *** [o.le-v7-g/Barcode4business] Error 1
make[1]: *** [debug] Error 2
make[1]: Leaving directory `C:/momentics-workspace/Barcode4business/arm'
make: *** [Device-Debug] Error 2

09:43:54 Build Finished (took 2s.901ms)

The app .pro file is:

 

APP_NAME = Barcode4business
TEMPLATE = app

QT += declarative
CONFIG += qt warn_on cascades10 mobility DpUtilities
LIBS += -lbb -lbbcascadesmultimedia -lbbdevice -lbbmultimedia -lbbsystem
LIBS += -lcamapi -lscreen -lzxing -lmmrndclient -lasound
LIBS += -L../assets -lBarcodeScanner
LIBS += -L../../DpUtilities/arm/so.le-v7-g -lDpUtilities
MOBILITY += sensors

INCLUDE *= /momentics-workspace/DpUtilities/include

include(config.pri)
#include($$quote($$_PRO_FILE_PWD_)/../DpUtilities/shared.pri)
include($$quote($$_PRO_FILE_PWD_)/../DpUtilities/static.pri)

 

The .pro file for the library is:

 

TEMPLATE = lib

SOURCES += ../src/*.cpp
HEADERS += ../include/*.hpp ../include/*.h

CONFIG += qt warn_on cascades_library mobility hardening
LIBS += -lbb -lbbcascadesmultimedia -lbbdevice -lbbmultimedia -lbbsystem -lscreen -lcamapi
#LIBS += -L../assets -lBarcodeScanner
INCLUDEPATH *= ../include
MOBILITY += sensors

# uncomment for building static library
CONFIG += staticlib

# uncomment for generating separate debug info
# CONFIG += separate_debug_info

include(cascades10_library.pri)

include(config.pri)

# specify a list of .ts files for supported languages
# TRANSLATIONS += $${TARGET}_en_US.ts

# uncomment following line to include translations to binary
# RESOURCES += translations/qm/DpUtilities_translations.qrc