Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Simple Include

This might be an obvious question but I've never written C/C++ untill recently.


In my 'src' folder I have a file called recordvideo.c


I want to include that in the main cpp file I had assumed I would do something like ...




Can anyone tell me how to properly include the c file? Also when you use #include what is the default path, e.g. in what folder is it looking for recordvideo.c?

co-founder of Diaree | BB Dev for PictureThis
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Simple Include

You don't include the source (c/cpp) files. They are compiled into the app binary. Header files (h/hpp) are the only ones that need to be included.
Posts: 54
Registered: ‎06-26-2012
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Simple Include

Thank you for the question.
You don't use the "#include" directive for .c files visibility, instead you use it to expose C/C++ types, classes, macros,...
i.e. your declarations located in your .h files to other .c/c++ files.
If you want your objects or global variables from your C/C+ files to be accessed by other C/C++ files, you can simply use the "extern" keywork (there are other ways to do that but this is the simplest way)

Please check our helloword application or the very basic apps for how to set your include path.


Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10
My Carrier: Rogers

Re: Simple Include

In addition...


When the include statement is:


#include <bb/cascades/QmlDocument>

 The compiler will look through the folders contained in the Include Path.. This is located in QNX Momentics IDE at:

Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes tab on the right... The compiler will look through the folders contained there in the order they are in from top to bottom.


When the include statement is:


#include "Box2D/Box2D.h"


The compiler will look for the file relative to the current file that the include statement is in.  That is, in the same folder that the current file is in... 


.../workspace/NDK/myApp.cpp <--- include statement "" it will look in .../workspace/NDK/ ...