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
xtravanta
Posts: 46
Registered: ‎03-25-2011
My Device: Blackberry Z10
Accepted Solution

undefined reference to bb::cascades::multimedia::Camera

[ Edited ]

Hi,

Iam trying to use the camera but even with this simple example i'm getting the "undefined reference".

hopefully somebody can point me in the right dirrection.

copy of the error: 

undefined reference to `bb::cascades::multimedia::Camera::Camera(bb::cascades::Container*)'

 

app.pro

LIBS += -lcamapi -lscreen

 

app.hpp

#ifndef APP_HPP_
#define APP_HPP_

#include <QObject>

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/multimedia/Camera.hpp>
#include <bb/cascades/multimedia/CameraSettings.hpp>
#include <bb/cascades/multimedia/CameraTypes.hpp>

using namespace bb::cascades;
using namespace bb::cascades::multimedia;

class App: public QObject {
Q_OBJECT
public:
	App(bb::cascades::Application *app);
	virtual ~App() {
	}

private:
	Camera *mCamera;
};

#endif /* APP */

 app.cpp

#include "app.hpp"

App::App(bb::cascades::Application *app) :
		QObject(app) {

	QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
	AbstractPane *root = qml->createRootObject<AbstractPane>();

	mCamera = new Camera();

	app->setScene(root);
}

 

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: undefined reference to bb::cascades::multimedia::Camera

Hi! You need to add -lbbcascadesmultimedia to .pro file

Andrey Fidrya, @zmeyc on twitter
Contributor
xtravanta
Posts: 46
Registered: ‎03-25-2011
My Device: Blackberry Z10

Re: undefined reference to bb::cascades::multimedia::Camera

Thx that worked!..

Can you also tell me how i was able to know this? where is the documentation of this :smileyhappy:
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: undefined reference to bb::cascades::multimedia::Camera

Sometimes it's mentioned in docs, not in this case though. :smileyhappy:

 

Linker can usually deduce library name. I don't remember how exact error message looks like, but it should mention  "libbbcascadesmultimedia.so" somewhere. When using -l key the "lib" is prepended automatically, so this becomes -lbbcascadesmultimedia.

 

Also bb ndk follows certain naming convention. For bb::system namespace the corresponding library is called libbbsystem.so and so on.

 

You can check available libraries in ./target_10_0_9_2318/qnx6/armle-v7/usr/lib/ 

It's often possible to guess which one is needed.

 

Otherwise grepping for the class name can give hints:

 

grep -r Camera|less

 

Binary file libbbcascades.so matches
Binary file libbbcascades.so.1 matches
Binary file libbbcascadesmultimedia.so matches
Binary file libbbcascadesmultimedia.so.1 matches
Binary file libbbcascadesmultimedia.so.1.0 matches
Binary file libbbcascadesmultimedia.so.1.0.0 matches
Binary file libbbmultimedia.so matches
Binary file libbbmultimedia.so.1 matches
Binary file libbbmultimedia.so.1.0 matches
Binary file libbbmultimedia.so.1.0.0 matches
Binary file libcamapi.so matches
Binary file libcamapi.so.1 matches
Binary file libexif.so matches
Binary file libexif.so.1 matches
Binary file libexifS.a matches
Binary file libwebkitplatform.so matches
Binary file libwebkitplatform.so.0 matches
Binary file libwebkitplatform.so.0.1 matches
Binary file libwebview.so matches
Binary file libwebview.so.2 matches
Binary file libwebview.so.2.0 matches
Binary file qt4/imports/bb/cascades/multimedia.1/libbbcascadesmultimediaqmlplugin_1.so matches
Binary file qt4/imports/bb/cascades/multimedia.1.0/libbbcascadesmultimediaqmlplugin_1_0.so matches
Binary file qt4/imports/QtMultimediaKit/libdeclarative_multimedia.so matches
Binary file qt4/lib/libQtCore.so matches
Binary file qt4/lib/libQtCore.so.4 matches
Binary file qt4/lib/libQtCore.so.4.8 matches
Binary file qt4/lib/libQtCore.so.4.8.4 matches
Binary file qt4/lib/libQtGui.so matches
Binary file qt4/lib/libQtGui.so.4 matches
Binary file qt4/lib/libQtGui.so.4.8 matches
Binary file qt4/lib/libQtGui.so.4.8.4 matches
Binary file qt4/lib/libQtMultimediaKit.so matches
Binary file qt4/lib/libQtMultimediaKit.so.1 matches
Binary file qt4/lib/libQtMultimediaKit.so.1.2 matches
Binary file qt4/lib/libQtMultimediaKit.so.1.2.2 matches

 

 

 


Andrey Fidrya, @zmeyc on twitter
Contributor
xtravanta
Posts: 46
Registered: ‎03-25-2011
My Device: Blackberry Z10

Re: undefined reference to bb::cascades::multimedia::Camera

Great thx!