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

Reply
Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified
Accepted Solution

Preprocessor in BB Eclipse Plugin 1.1

[ Edited ]

 

Custom preprocessor defines do not seem to work in BB Eclipse Plugin v1.1

 

I managed to get the precompiler running properly in my new setup, but all defines are ignored except those supplied by the environment.  Here is some sample code demonstrating what I mean:

//PROBLEM
//Preprocessor directives defined by me either as 
//Workspace scope (Windows->Preferences) or 
//Project scope (BlackBerry_App_Descriptor.xml) are 
//ignored ... as though they are not defined.
//#ifndef MY_TAG
/*
//#endif
//THIS COMMENT REMAINS IN THE CODE AFTER PRECOMPILE
//#ifndef MY_TAG
*/
//#endif
//#ifdef MY_TAG
/*
//#endif
//THIS COMMENT GETS REMOVED.
//#ifdef MY_TAG
*/
//#endif
//Preprocessor directives for the SDK scoped variables work properly.
//#ifdef BlackBerrySDK4.5.0
//THIS COMMENT REMAINS IN THE CODE ONLY WHEN USING COMPONENT PACK 4.5.0
//#endif

 

It doesn't matter if I define MY_TAG at the Workspace scope or at the project scope, the precompiler ALWAYS considers MY_TAG to be undefined.

 

Any ideas what I could be doing wrong?  Is this a known broken feature?

 

Thanks,

~NN

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Preprocessor in BB Eclipse Plugin 1.1

[ Edited ]

Are you placing the //#preprocess comment at the first line for every file you are using preprocessor tags?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: Preprocessor in BB Eclipse Plugin 1.1

[ Edited ]

yes I have the //#preprocess at the top of the file (it's a one file hello world project), no spaces or empty lines or anything in front of it.

 

I know that the preprocessor is running because I get a .preprocessed folder that has a copy of my source file in it with the preprocessor directives removed and all comments that are tagged as not showing up in my original post missing as well.  The preprocessor just isn't aware of the defines I am setting through the Eclipse UI.  The preprocessor IS aware of the defines that are set inherently by including a JRE in the project. (i.e. the defines that are named like BlackBerrySDK4.5.0) and it properly handles any ifdef / ifndef that looks at those defines.

Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: Preprocessor in BB Eclipse Plugin 1.1

I'm curious if anybody has ever had this working in one of their own projects or if the feature just flat out doesn't work at all?  Just to be precise, what I'm asking is:

 

Has anybody been able to set their own custom precompiler define value using BB Java Plugin for Eclipse v1.1 with Eclipse 3.5 (Galileo) and had that define properly trigger ifdef and ifndef directives within their code? (And if so, do you see anything you did differently than I have based on my original post?)

 

Thanks,

~NN

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Preprocessor in BB Eclipse Plugin 1.1

I've been using it since the 1.0 and its way better in the 1.1. Works fine on 4 of my projects.
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: Preprocessor in BB Eclipse Plugin 1.1

Yeah, I've had preprocessor directives working fine for several projects last year using the 1.0 BB plugin for Eclipse, it's just the 1.1 plugin that I can't get to work.  Which is a shame, because 1.1 looks like it should be SO much more slick than the old version.

 

Well, at least I know there is one person who has been able to get this working.  I'll keep trying tweaking things and see what I can get to work.  If you think of anything that you maybe are doing differently than I described, please let me know.

 

Thanks,

~NN

Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: Preprocessor in BB Eclipse Plugin 1.1

Powered on my dev box today and gave this another try.   It just worked.  I don't have any idea what changed though :-(

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Preprocessor in BB Eclipse Plugin 1.1

What version of Windows are you running on your dev box?
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 73
Registered: ‎10-23-2009
My Device: Not Specified

Re: Preprocessor in BB Eclipse Plugin 1.1

It's XP

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Preprocessor in BB Eclipse Plugin 1.1

Everything ok or you still having the same issue.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful