Porting to Blackberry


I have been trying to port a simple Cocos2d-x Xcode project to Blackberry, using this tutorial: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_and_Tests_on_BlackBerry_Tablet_OS

I can now easily import (Import->Existing Projects into Workspace), and run the test-projects a Blackberry Playbook, using “QNX Momentics”.
However, I cannot import my own Cocos2d-x Xcode-project.

I have tried using the file “create-qnx-project.sh” to generate a qnx-file/folder, but importing this i get the following errors when building:

../main.cpp:1:21: error: cocos2d.h: No such file or directory ../main.cpp:2:25: error: AppDelegate.h: No such file or directory ../main.cpp:5: error: expected constructor, destructor, or type conversion before ';' token ../main.cpp: In function 'int main(int, char**)': ../main.cpp:9: error: 'AppDelegate' was not declared in this scope ../main.cpp:9: error: 'app' was not declared in this scope ../main.cpp:11: error: expected type-specifier before 'AppDelegate' ../main.cpp:11: error: expected ';' before 'AppDelegate' ../main.cpp:12: error: 'cocos2d' has not been declared ../main.cpp:13: error: type '<type error>' argument given to 'delete', expected pointer


In cocos2d-x v1.0.:
You should also import cocos2dx, cocosdenshion, Box2D, chipmunk since the project you created depends on these four project.
In v2.0.
, you just need to import cocos2dx and cocosdenshion.


Hi James,

I’m also having a trouble running cocos2dx on BlackBerry. (Getting SIGSEGV runtime error at glCreateProgram() — http://www.cocos2d-x.org/boards/6/topics/15064)
Is there anything you could advise to try to get the sample projects running on the simulator?



Hi James,

Thanks for you answer.

In cocos2d-x v1.0.*:
You should also import cocos2dx, cocosdenshion, Box2D, chipmunk since the project you created depends on these four project.
I am using cocos2d-x v1.0.1, but it seems that I have already done this, since I followed the tutorial on http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_and_Tests_on_BlackBerry_Tablet_OS.

I’ve tried now to delete everything, and start all over.

If I understand the process correctly, what I need to do after importing the core/test-projects, is to generate a QNX-file/folder for my own project, and import this into “Momentics” (is this correct?).

When I run “create-qnx-project.sh”, it doesn’t seem to convert my own project - but instead generate a new, almost empty, QNX-project folder (which I can import into “Momentics”, but i get the error from my first post).


Hi again!,

I think I’ve solved the problem. I see now that I misunderstood the whole QNX-generating thing.

Here’s a short guide, for anyone with the same problem:

  1. Have a look at the guide at http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_and_Tests_on_BlackBerry_Tablet_OS
  2. Import the folder “cocos2d-1.0.**" into QNX Momentics. Select all .qnx-files/folders from the list.
  3. Generate a QNX-project using this guide: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_create_qnx_project_with_script. This will create a almost empty project and a folder, inside your "cocos2d-1.0.**”-folder. This folder contains the folders “Classes”, “qnx” and “Resources”.
  4. Copy your classes from your actual project into “Classes” (HOWEVER DON’T COPY “AppDelegate.cpp,h”).
  5. Create an empty folder called “empty”, in the folder “qnx”.
  6. Inside QNX Momentics, import a project again, and this time just pick the folder which was created with http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_create_qnx_project_with_script (inside folder “cocos2d-1.0.*”).
  7. Build and run by right-clicking on the project. It should now be possible to run your project on a BlackBerry PlayBook


Thorbjørn — Congrats and thanks for sharing. Have you been able to run the sample projects? Have you also tried it with v2.0? I’m still struggling with running the sample projects on my simulator…


Hi Wang,

For now I have only tried this with v1.0, and I’ve only had this work for an actual BlackBerry (had some problems with the simulator, too).

The sample projects works fine though - you shouldn’t have to follow step 3, 4, 5 and 6 for this however (when importing my cocos2d-1.0.* folder, the sample projects are also imported).