I have an application with several different Targets defined. I know that I can use preprocessor directives to have different sections of code for different targets, but how do the naming conventions work? For instance, if I have two Targets called "Smith" and "Smith Plus" how do these translate?
#if (Smith)
#elif (Smith Plus)
#endif
You basically have it right.
In your project settings, when you click on a target you will see a tab for 'build settings'. Under there search for preprocessor macros. For your smith target, add a the preprocessor macro "SMITH=1". Do the same for your smith plus target (SMITH_PLUS=1).
Then, in your code, you just use the like you illustrated yourself:
#if SMITH
// do something
#elif SMITH_PLUS
// do something else
#endif
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.