02-11-2013 07:47 AM - edited 02-11-2013 07:53 AM
Hi,
I have a problem in linking my libraries with a cascades project. I have ocut it down to a minimal and tries to give a picture of what I am doing below:
Blackberry static library - to act as an interface for several Secure Elements
interface-project
|_src
|_includes
| |_NFCInterface.hpp
|_cpps
|_NFCInterface.cpp
NFCInterface.hpp
#ifndef NFC_INTERFACE_HPP_
#define NFC_INTERFACE_HPP_
class NFCInterface {
public:
NFCInterface();
virtual ~NFCInterface();
};
#endif /* NFC_INTERFACE_HPP_ */NFCInterface.cpp
#include "../includes/NFCInterface.hpp"
NFCInterface::NFCInterface() {
}
NFCInterface::~NFCInterface() {
}Above project compiles without any problem.
Blackberry static library - An implementation for UICC
interface-project-impl
|_src
|_includes
| |_NFCInterfaceImpl.hpp
|_cpps
|_NFCInterfaceImpl.cpp
NFCInterfaceImpl.hpp
#ifndef NFC_INTERFACE_IMPL_
#define NFC_INTERFACE_IMPL_
#include <NFCInterface.h>
class NFCInterfaceImpl:public NFCInterface {
public:
NFCInterfaceImpl();
virtual ~NFCInterfaceImpl();
};
#endif /* NFC_INTERFACE_IMPL_ */NFCInterfaceImpl.cpp
#include "../includes/NFCInterfaceImpl.h"
NFCInterfaceImpl::NFCInterfaceImpl() {
// TODO Auto-generated constructor stub
}
NFCInterfaceImpl::~NFCInterfaceImpl() {
// TODO Auto-generated destructor stub
}The above project with -I <project location>/src/includes -L<Library location> -lnfcinterface compiles without any problem.
Blackberry cascades project - the acutal front end
test-project
|_src
|_main.cpp
|_TestLib.cpp
|_TestLib.hpp
TestLib.hpp
// Tabbed pane project template
#ifndef TestLib_HPP_
#define TestLib_HPP_
#include <QObject>
namespace bb { namespace cascades { class Application; }}
/*!
* @brief Application pane object
*
*Use this object to create and init app UI, to create context objects, to register the new meta types etc.
*/
class TestLib : public QObject
{
Q_OBJECT
public:
TestLib(bb::cascades::Application *app);
virtual ~TestLib() {}
};
#endif /* TestLib_HPP_ */TestLib.cpp
// Tabbed pane project template
#include "TestLib.hpp"
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include "NFCInterfaceImpl.h"
using namespace bb::cascades;
TestLib::TestLib(bb::cascades::Application *app)
: QObject(app)
{
// create scene document from main.qml asset
// set parent to created document to ensure it exists for the whole application lifetime
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(th is);
// create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
app->setScene(root);
NFCInterfaceImpl test;
}
Now in the above project, in the pro file I have
INCLUDEPATH += \
../NFCInterface/src/includes \
../NFCInterfaceImpl/src/includes
LIBS += \
-LC:/Users/myuseraccount/ndk-10.0.9-workspace/NFCI nterface/Device-Debug \
-LC:/Users/myuseraccount/ndk-10.0.9-workspace/NFCI nterfaceImpl/Device-Debug \
-lnfcinterface \
-lnfcinterfaceimplIf I compile I get the following error:
Could not find qmake configuration directoryCould not find qmake configuration fileUsing OS scope before setting MAKEFILE_GENERATORC:/Users/myaccountname/ndk-10.0.9-workspace/NFCInterfaceImpl/Device-Debug\libNFCIn terfaceImpl.a(NFCInterfaceImpl.o): In function `NFCInterfaceImpl': make[2]: Leaving directory `C:/Users/myaccountname/ndk-10.0.9-workspace/test- lib/arm' C:\Users\myaccountname\ndk-10.0.9-workspace\NFCInt erfaceImpl\Device-Debug/..\src\cpps/NFCInterfaceIm pl.cpp:10: undefined reference to `NFCInterface::NFCInterface()' make[1]: Leaving directory `C:/Users/myaccountname/ndk-10.0.9-workspace/test- lib/arm' C:/Users/myaccountname/ndk-10.0.9-workspace/NFCInt erfaceImpl/Device-Debug\libNFCInterfaceImpl.a(NFCI nterfaceImpl.o): In function `~NFCInterfaceImpl': C:\Users\myaccountname\ndk-10.0.9-workspace\NFCInt erfaceImpl\Device-Debug/..\src\cpps/NFCInterfaceIm pl.cpp:17: undefined reference to `NFCInterface::~NFCInterface()' cc: C:/Users/myaccountname/Applications/bbndk/host_10_ 0_9_404/win32/x86/usr/bin/ntoarm-ld caught signal 1 make[2]: *** [o.le-v7-g/test_lib] Error 1 make[1]: *** [debug] Error 2 make: *** [Device-Debug] Error 2
Could not figure out what's wrong. Is this the correct way to implement libraries (with the cascades)? I know I am missing something basic. If anybody can figure out, please point out.
Please let me know if you need more information in this regard.
Thanks
02-11-2013 01:31 PM
02-11-2013 04:03 PM
Doe it compile successfully if you remove your additions to .pro file?
02-12-2013 06:40 AM
Thanks CMY. Though I compile it on Windows, I take your point as it looks like a cygwin involvement. However, even after changing the case, it is still the same.
Cheers
02-12-2013 06:42 AM
02-12-2013 11:26 AM
02-14-2013 02:47 PM
Another thing to consider: you make nfcinterfaceimpl wih statically linked nfcinterface library, i.e. impl binary already contains all the code from nfcinterface. Then you are trying to build your app with static linking of both libraries, this way in your final binary you'll have two instances of nfcinterface library. I am not sure how well linker handles that. Also it would be nice to see all console output when you build your final app.