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
Contributor
chrisandrewca
Posts: 11
Registered: ‎05-04-2011
My Device: None
Accepted Solution

How to call moc.exe for shared library using Qt?

[ Edited ]

I've created a shared library using the managed build system and one of the classes in the library uses Qt signals and slots. When I create a cascades app I can add the library to my project and everything seems alright. However when I compile the app which uses the lib I get the following errors.

 

qcc -Vgcc_ntox86 -lang-c++ -Wl,-rpath-link,C:/bbndk/target_10_0_9_1673/qnx6/x86/lib -Wl,-rpath-link,C:/bbndk/target_10_0_9_1673/qnx6/x86/usr/lib -Wl,-rpath-link,C:/bbndk/target_10_0_9_1673/qnx6/x86/usr/lib/qt4/lib -o o-g/simplehttp o-g/.obj/Simplehttp.o o-g/.obj/main.o o-g/.obj/moc_Simplehttp.o    -LC:/bbndk/target_10_0_9_1673/qnx6/x86/lib -LC:/bbndk/target_10_0_9_1673/qnx6/x86/usr/lib -LC:/bbndk/target_10_0_9_1673/qnx6/x86/usr/lib/qt4/lib -LC:/bbndk/target_10_0_9_1673/qnx6/armle-v7/usr/lib/qt4/lib -L../../simplehttplib/Device-Debug -L../../simplehttplib/Device-Release -L../../simplehttplib/Simulator-Debug -lsimplehttplib -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lsqlite3 -lz -lQtXmlPatterns -lQtGui -lQtNetwork -lsocket -lQtCore -lm -lbps 
Could not find qmake configuration directoryCould not find qmake configuration fileUsing OS scope before setting MAKEFILE_GENERATORC:\bbndk\host_10_0_9_404\win32\x86\usr\bin\ntox86-ld: skipping incompatible ../../simplehttplib/Device-Debug/libsimplehttplib.so when searching for -lsimplehttplib
C:\bbndk\host_10_0_9_404\win32\x86\usr\bin\ntox86-ld: skipping incompatible ../../simplehttplib/Device-Release/libsimplehttplib.so when searching for -lsimplehttplib
../../simplehttplib/Simulator-Debug/libsimplehttplib.so: undefined reference to `PostHttp::staticMetaObject'
../../simplehttplib/Simulator-Debug/libsimplehttplib.so: undefined reference to `vtable for PostHttp'
make[2]: Leaving directory `C:/projects/bbworkspace/simplehttp/x86'
../../simplehttplib/Simulator-Debug/libsimplehttplib.so: undefined reference to `RequestHeaders::complete(QString const&)'
make[1]: Leaving directory `C:/projects/bbworkspace/simplehttp/x86'
../../simplehttplib/Simulator-Debug/libsimplehttplib.so: undefined reference to `PostHttp::complete(QString const&)'
../../simplehttplib/Simulator-Debug/libsimplehttplib.so: undefined reference to `vtable for RequestHeaders'
cc: C:/bbndk/host_10_0_9_404/win32/x86/usr/bin/ntox86-ld caught signal 1
make[2]: *** [o-g/simplehttp] Error 1
make[1]: *** [debug] Error 2
make: *** [Simulator-Debug] Error 2

 After some googling I believe the error is due to moc not being run to provide the implementations for signals and slots in the shared library. I've come across this page https://developer.blackberry.com/cascades/reference/moc.html but I'd rather not use a Makefile build. Is there a way I can fix this using managed build? I'm thinking that's the issue anyways but all ideas are welcome!

Contributor
chrisandrewca
Posts: 11
Registered: ‎05-04-2011
My Device: None

Re: How to call moc.exe for shared library using Qt?

I also tried to compile this LGPL OAuth library (https://github.com/blackberry/bb-cascades-oauth) into a shared library so I can use it with my cascades app and I ran into the same issues. Just need to figure out how to call moc when compiling the lib I'm thinking.

Contributor
chrisandrewca
Posts: 11
Registered: ‎05-04-2011
My Device: None

Re: How to call moc.exe for shared library using Qt?

I created a python script to do this. It scans the supplied header dir recursively, I put it on Github in case it helps anyone: https://github.com/chrisandrewca/mocpy

Regular Contributor
mdmdev
Posts: 75
Registered: ‎11-30-2012
My Device: curve

Re: How to call moc.exe for shared library using Qt?

can you please tell how you created a shared library.?
Contributor
chrisandrewca
Posts: 11
Registered: ‎05-04-2011
My Device: None

Re: How to call moc.exe for shared library using Qt?

[ Edited ]
Developer
yamyu
Posts: 21
Registered: ‎06-15-2012
My Device: 9900

Re: How to call moc.exe for shared library using Qt?

 @chrisandrewca, i think your method is good. but i dont wanto manual create moc_xxx.cpp because if .h file  are modified about qt , i have to recreate the moc_XXXX.cpp . any suggestion?thanks