Welcome!

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

Java 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.


Reply
Highlighted
Developer
Posts: 54
Registered: ‎11-12-2009
My Device: Not Specified
Accepted Solution

Preprocessor directives for multiple JDEs

Hello,

 

I am working with the preprocessor directives currently, and was able to use it successfully for my sample application.I am using the Blackberry Java Plugin for Eclipse for my development, and have observed that it provides certain predefined directives for all the JDEs ( I am working with JDE 5.0, 6.0, 7.0 and 7.1) While I understand that each preprocessor can correspond to a single JDE only, I want to use a single preprocessor statement  for multiple JDEs.

 

For example instead of :

 

 

//#ifdef BlackBerrySDK6.0.0
        setTitle( "HelloBlackBerry 6.0.0" );
 //#endif

 I want to put a preprocessor that works for JDE 6.0.0 and all JDEs above 6.0.0 :

 

//#ifdef BlackBerrySDK6.0.0 or BlackBerrySDK7.0.0 or BlackBerrySDK7.1.0
        setTitle( "HelloBlackBerry" );
 //#endif

 

In short, can I have logical AND | OR operations amongst the preprocessor directives?

 

Any help will be highly appreciated!

Thanks.

Developer
Posts: 54
Registered: ‎11-12-2009
My Device: Not Specified

Re: Preprocessor directives for multiple JDEs

I figured it out, probably using the | and & operators works :

 

//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0
do something
//#endif

 Though I am amazed how none of the so many articles on preprocessor directives mentions about this!

Developer
Posts: 54
Registered: ‎11-12-2009
My Device: Not Specified

Re: Preprocessor directives for multiple JDEs

Has anyone used a combination of & and | operators in a directive?

 

For example :

 

//#ifdef myPreprocessor & (BlackBerrySDK7.0.0 | BlackBerrySDK7.1.0)

 The compiler gives me an error that a combination of & and | cannot be used with //#if statement..How do I go about achieving this then..