问题描述
大家好,我正在使用cocos2d-x和blackberry创建一个简单的游戏.我需要一些地方来存储我的游戏设置,类似于ios和android中的共享首选项.我使用qsettings找到了一些代码,但是问题是我无法添加QtCore库.
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.
我使用RightClick-> configure-> add Library和Standard BlackBerry Platform 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");
}
但是当我编译上面的代码时,出现错误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 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
但是我注意到两件事,我包含的QtCore目录中有1.qglobal.h文件.2.在qatomic.h内部(如果我更改
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>
进入
#ifndef QATOMIC_H
#define QATOMIC_H
#include <qglobal.h>
#include <QtCore/qbasicatomic.h>
qglobal的错误消失了,现在qbasicatomic.h也出现了同样的错误.
the error for qglobal goes and now the same error comes for qbasicatomic.h.
我认为这很简单,例如QtCore关键字与包含目录之类的映射不正确.
I think it is something simple like incorrect mapping between QtCore keyword and include directory or something..
请看看.
IDE是在Eclipse上制作的.
The IDE is made on eclipse.
推荐答案
如果仔细查看错误消息,您可以了解出了什么问题:
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
错误不包含在QtCore
中,而是发生在QtCore/qatomic.h
内部,在第45行(您可以在[YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h
中找到此文件):
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
已经在QtCore
目录中,并且您还将在其中找到qglobal.h
目录.因此,这意味着qatomic.h希望父目录位于包含路径上,以便包含<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.
因此,您只需要将[YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4
添加到您的包含目录中即可.
So you just need to add [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4
to your include directories.
这样做:
- 在Project Explorer中右键单击您的项目,然后选择
Properties
- 将树扩展到
C/C++ General
/Paths and Symbols
- 将路径和符号"框中的配置更改为
[All configurations]
- 单击
Includes
标记,然后在语言"列表中选择GNU C
(或对每种语言都执行此操作). - 单击
Add...
并键入${QNX_TARGET}/usr/include/qt4
并按OK
- 单击
Add...
并键入${QNX_TARGET}/usr/include/qt4/QtCore
并按OK
- Right click over your project in Project Explorer and choose
Properties
- Expand the tree to
C/C++ General
/Paths and Symbols
- Change the Configuration in the Paths and Symbols frame to
[All configurations]
- Click the
Includes
tag and selectGNU C
in the Languages list (or do this for every language). - Click
Add...
and type${QNX_TARGET}/usr/include/qt4
and pressOK
- Click
Add...
and type${QNX_TARGET}/usr/include/qt4/QtCore
and pressOK
现在您包含#include< QtCore>了.应该可以.
Now your include of #include <QtCore> should work.
下一步:链接错误;-)
Next up: linking errors ;-)
这篇关于在Blackberry 10 SDK中添加QtCore库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!