Geo Paul
Geo Paul

Reputation: 1817

Adding QtCore Library in blackberry 10 sdk

Hi guys I am creating a simple game using cocos2d-x and blackberry. I need some place to store my game settings, something similar to shared preferences in ios and android. I found some code using qsettings, but the problem is I am not able to add the QtCore library.

I add the library using RightClick->configure->add Library and Standard BlackBerry Platform Library. The library gets added successfully.

#include "dataProcessor.h"
#include <QtCore>

void dataProcessor::setup(){
    QDir dir;
    dir.mkpath("data/files/text");
    dir.cd("data/files/text");
}

but when I compile the above code, I get the error C:/Users/I076636/Documents/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28: fatal error: QtCore/qglobal.h: No such file or directory

But I noticed 2 things, 1.qglobal.h file is there inside the QtCore directory I have included. 2.inside qatomic.h if I change

#ifndef QATOMIC_H
#define QATOMIC_H

#include <QtCore/qglobal.h>
#include <QtCore/qbasicatomic.h>

into

#ifndef QATOMIC_H
#define QATOMIC_H

#include <qglobal.h>
#include <QtCore/qbasicatomic.h>

the error for qglobal goes and now the same error comes for qbasicatomic.h.

I think it is something simple like incorrect mapping between QtCore keyword and include directory or something..

Please do have a look.

The IDE is made on eclipse.

Upvotes: 2

Views: 2952

Answers (2)

craigmj
craigmj

Reputation: 5077

You can understand what is going wrong if you look closely at the error message:

/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28:
fatal error: QtCore/qglobal.h: No such file or directory

The error isn't in your inclusion of QtCore, but is occurring inside QtCore/qatomic.h, on line 45 (you can find this file in the [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h):

#include <QtCore/qglobal.h>

qatomic.h is already in the QtCore directory, and you'll find a qglobal.h directory there as well. So what this means is that qatomic.h expects the parent directory to be on the include path, so that including <QtCore/qglobal.h> will work.

So you just need to add [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4 to your include directories.

Do it like this:

  1. Right click over your project in Project Explorer and choose Properties
  2. Expand the tree to C/C++ General / Paths and Symbols
  3. Change the Configuration in the Paths and Symbols frame to [All configurations]
  4. Click the Includes tag and select GNU C in the Languages list (or do this for every language).
  5. Click Add... and type ${QNX_TARGET}/usr/include/qt4 and press OK
  6. Click Add... and type ${QNX_TARGET}/usr/include/qt4/QtCore and press OK

Now your include of #include <QtCore> should work.

Next up: linking errors ;-)

Upvotes: 5

Richard
Richard

Reputation: 8920

It sounds like your BB10 NDK did not get installed properly, or your project wasn't set up properly. If you expand your project and the Includes you should see (along with others):

<NDK_INSTALL_LOCATION>/target_<VERSION>/qnx6/usr/include/qt4/QtCore

Upvotes: 0

Related Questions