Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to use preprocessor symbols?

From Wiki
Jump to: navigation, search
Article Metadata
Created: senthil_k (20 Nov 2007)
Last edited: hamishwillee (15 Aug 2013)

If you are using an IDE like eclipse or NetBeans & also you want to make a same source for two different phones then you may make use of pre-processing symbols.

For example you have two phones, one a Nokia MIDP 1.0 phone having fullcanvas & other phone is a MIDP 2.0 phone. So in the first phone the source should have Fullcanvas & in the other, just Canvas. For this use the following code

//#ifdef Nokia
public class Main extends FullCanvas {
public class Main extends Canvas {

This is also useful in cases where a same source is used for different resolution phones. eg:

//#ifdef NOKIA_NGAGE
width= 176;
//#elseif NOKIA_3100
width = 128;
height = 128;
//#elseif NOKIA_6300
width = 240;
height = 320;

This preprocessing symbol has a major use in the porting industry.

This page was last modified on 15 August 2013, at 06:33.
14 page views in the last 30 days.