From the QNX Momentics IDE, select New -> BlackBerry Tablet OS C/C++ Project.
Enter a project name in the field. You cannot use spaces. I recommend something like TestProject-01 or similar so that you can keep creating tests to practice with.
Use the default location for the files, this will be in your Workspace chosen when you first ran the IDE.
Now you will have to choose which type of project it is going to be and what language. For this first project choose C and Empty Application Project.
You may also have to choose if you are going to use the simulator if this is the first project you’ve set up in the IDE. If you have signing keys, now is the time to use them. You won’t be asked for future projects. If you are just going to use the Simulator, then just select that you don’t want to register right now and let’s move on!
If you expand “TestProject-01″ in the Project Explorer, you will see it has Includes, a src foler, a bar-descriptor.xml and an icon (icon.png). The main window is going to show your bar-descriptor.xml file.
We’re going to come back to the Bar Descriptor in the next post. This one is just to get it to run!
Right click on the src folder and select “New File“. In the file name dialog enter main.c
You’ll now have a blank file displayed in your editor. Type in the following lines:
|
1 2 3 4 5 6 7 8 9 10 |
// Our First BBX Native SDK Program!
#include <stdlib.h>
#include <stdio.h>
int main() {
fprintf( stderr, "Weeeeeee!" );
return 0;
} |
The two include directives at the top include the standard C libraries.
We add our main function as that is the default starting place for projects. We print something to the stderr output (which is the console in the editor) and return 0 for success!
From the Project menu, select Build Configurations -> Set Active -> Simulator. That tells the project to build for the Simulator which we are going to test on.
Select Project -> Build Project
Then Run -> Run.
If all goes well, you will see the BlackBerry logo appear on your simulator, then the console in the IDE will print out “Weeeeee!” and the program will exit. Notice that you now have an Icon on the Simulator to run TestProject-01 anytime you like.