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
New Contributor
DamienDub
Posts: 5
Registered: ‎08-21-2013
My Device: Z10, Q10
Accepted Solution

Unable to include static library containing QObject class into Cascades project

I work on the new BB10 platform based on Qt.

I have one static library project which defines a QObject class (basically the class sends signals and has a few slots). The project compiles fine and provides me with a nice libwhathever.a file

When I try to include this library in my Cascades project I get these errors when building:

  • undefined references to com::vasco::digipass::sdk::utils::qrcodescanner::MyClass::staticMetaObject
  • undefined reference to com::vasco::digipass::sdk::utils::qrcodescanner::MyClass::newQRCodeDetected(QString)
  • undefined reference to com::vasco::digipass::sdk::utils::qrcodescanner::MyClass::staticMetaObject external location: c:\Developer\bbndk\target_10_1_0_2342\qnx6\usr\include\qt4\QtCore\qobject.h
  • undefined reference to com::vasco::digipass::sdk::utils::qrcodescanner::MyClass::staticMetaObject external location: c:\Developer\bbndk\target_10_1_0_2342\qnx6\usr\include\qt4\QtDeclarative\qdeclarative.h
  • undefined reference to com::vasco::digipass::sdk::utils::qrcodescanner::MyClass::staticMetaObject external location: c:\Developer\bbndk\target_10_1_0_2342\qnx6\usr\include\qt4\QtDeclarative\qdeclarative.h
  • undefined reference to vtable for com::vasco::digipass::sdk::utils::qrcodescanner::MyClass
  • undefined reference to vtable for com::vasco::digipass::sdk::utils::qrcodescanner::MyClass

I suspect that I miss the compilation step where the Q_OBJECT macro is handled. Am I on the right track ? I have heard about moc and qmake but I don't know how nor when to use them in my build process.

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Unable to include static library containing QObject class into Cascades project

welcome to the support forums.

how do you build the project? on the console? there is a nice article series on the developer blog about that, maybe it helps.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
DamienDub
Posts: 5
Registered: ‎08-21-2013
My Device: Z10, Q10

Re: Unable to include static library containing QObject class into Cascades project

Hi Simon,

For my static library project I use the regular build tool from Momentics. I also made an ANT script that basically calls the qcc compiler on the source files and packages the static library.

I had other static library projects that have compiled fine so far. This one fails because I have a QObject in it.

For my cascades project I just use the build tool from Momentics.
New Contributor
DamienDub
Posts: 5
Registered: ‎08-21-2013
My Device: Z10, Q10

Re: Unable to include static library containing QObject class into Cascades project

I actually solved my problem simply by running moc on the header file defining the Q_OBJECT. It generated the moc file I needed. Then my ant script did the rest of the compiling with qcc and my undefined references disappeared.

Contributor
sven_niemann
Posts: 12
Registered: ‎09-18-2013
My Device: Z10

Re: Unable to include static library containing QObject class into Cascades project

Can you explain how you solved it? I don't know how to handle the moc running
New Contributor
DamienDub
Posts: 5
Registered: ‎08-21-2013
My Device: Z10, Q10

Re: Unable to include static library containing QObject class into Cascades project

In my case I just ran the moc binary provided by the blackberry sdk on the header file containing the Q_OBJECT definition. It generated a moc_xxx file that I later included in my static library archive.
Contributor
jial
Posts: 26
Registered: ‎09-20-2013
My Device: Z10

Re: Unable to include static library containing QObject class into Cascades project

I got the same problem. where is this moc? how do i add the moc files into the project?

New Developer
emansfield
Posts: 30
Registered: ‎06-13-2014
My Device: Z30

Re: Unable to include static library containing QObject class into Cascades project

Can somebody give us some help here, please.  How exactly do you include the moc_xxx files in the library?