10-19-2010 01:33 PM - edited 10-19-2010 01:33 PM
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?
Solved! Go to Solution.
10-19-2010 02:36 PM - edited 10-19-2010 02:36 PM
Are you placing the //#preprocess comment at the first line for every file you are using preprocessor tags?
10-20-2010 07:46 AM - edited 10-20-2010 07:48 AM
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.
10-20-2010 12:28 PM
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?)
10-20-2010 12:51 PM
10-20-2010 01:37 PM
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.
10-21-2010 02:47 PM
11-24-2010 05:28 PM