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
Regular Contributor
Posts: 55
Registered: ‎03-14-2012
My Device: RDJ21WW
My Carrier: none

undefined reference to `vtable for

 While building the Qt application in  Momentics IDE for MS Windows to Blackberry Playbook, got the error as "undefined reference to `vtable for ". Did anyone face this problem and know how to solve this problem?

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: undefined reference to `vtable for

run

moc <your_file.h> -o <moc_your_file.c>

 for every .h file that contains QOBJECT, then import Refresh your src folder - these moc_xxx.c files should appear. Now you can build.

Regular Contributor
Posts: 55
Registered: ‎03-14-2012
My Device: RDJ21WW
My Carrier: none

Re: undefined reference to `vtable for

Thanks for your reply.After executing the moc command in the properties->build steps ,again i got the same errror.

I have attached the error.

 

**** Internal Builder is used for build ****
moc ../src/IMView.h -o moc_IMView.cpp
qcc -o src\main.o ..\src\main.cpp -V4.4.2,gcc_ntoarmv7le_cpp -w1 -IF:/bbndk-2.0.0/target/qnx6/usr/include/freetype2 -IF:\qt-arm\armv7le\include -IF:\qt-arm\armv7le\include\QtCore -IF:\qt-arm\armv7le\include\QtGui -IF:\qt-arm\armv7le\include\QtNetwork -IF:\qt-arm\armv7le\include\QtWebKit -IF:/bbndk-2.0.0/target/qnx6/../target-override/usr/include -D_FORTIFY_SOURCE=2 -c -O2 -fstack-protector-all -fPIE -frecord-gcc-switches
qcc -o src\IMView.o ..\src\IMView.cpp -V4.4.2,gcc_ntoarmv7le_cpp -w1 -IF:/bbndk-2.0.0/target/qnx6/usr/include/freetype2 -IF:\qt-arm\armv7le\include -IF:\qt-arm\armv7le\include\QtCore -IF:\qt-arm\armv7le\include\QtGui -IF:\qt-arm\armv7le\include\QtNetwork -IF:\qt-arm\armv7le\include\QtWebKit -IF:/bbndk-2.0.0/target/qnx6/../target-override/usr/include -D_FORTIFY_SOURCE=2 -c -O2 -fstack-protector-all -fPIE -frecord-gcc-switches
qcc -o QtSampleIM src\main.o src\IMView.o -lQtCore -lQtGui -lQtNetwork -lQtOpenGL -lQtWebKit -V4.4.2,gcc_ntoarmv7le_cpp -w1 -lang-c++ -Wl,-z,relro -Wl,-z,now -pie -LF:/bbndk-2.0.0/target/qnx6/../target-override/armle-v7/lib -LF:\qt-arm\armv7le\lib -LF:/bbndk-2.0.0/target/qnx6/../target-override/armle-v7/usr/lib
src\IMView.o: In function `IMView::~IMView()':
IMView.cppSmiley Sad.text+0x84): undefined reference to `vtable for IMView'
src\IMView.o: In function `IMView::~IMView()':
IMView.cppSmiley Sad.text+0x104): undefined reference to `vtable for IMView'
src\IMView.o: In function `IMView::~IMView()':
IMView.cppSmiley Sad.text+0x17c): undefined reference to `vtable for IMView'
src\IMView.o: In function `IMView::IMView(QWidget*)':
IMView.cppSmiley Sad.text+0x224): undefined reference to `vtable for IMView'
src\IMView.o: In function `IMView::IMView(QWidget*)':
IMView.cppSmiley Sad.text+0x2cc): undefined reference to `vtable for IMView'
cc: F:/bbndk-2.0.0/host/win32/x86/usr/bin/ntoarm-ld caught signal 1
Build error occurred, build is stopped

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: undefined reference to `vtable for

You did not perform refresh. Just select you src folder in Project explorer and Project refresh. You should see moc_x.c added to src folder and linker should pick up its .o file.
Developer
Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: undefined reference to `vtable for

Include all the sources and headers correctly in your .pro file.

 

SOURCES += ../src/*.cpp

HEADERS += ../src/*.hpp

 Add additional files accordingly.