About Store Forum Documentation Contact



Post Reply 
Conditional compilation directives
Author Message
Pixel Perfect Offline
Member

Post: #1
Conditional compilation directives
Excuse my cross platform ignorance but, although I am currently only targeting my game @ Windows, I would like to maintain my code as cross platform as possible. Can I freely use conditional compilation directives such as:

#define identifier

#ifdef identifier
// code
#else
// code
#endif

and expect those to be implemented by the target compilers on the other platforms?
06-11-2013 05:42 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
RE: Conditional compilation directives
You can, but if you are using the EE 2.0 code editor, it doesn't recognize them across multiple files.
I'm counting on being able to use the engine versions like EE_MOBILE.
06-11-2013 06:51 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #3
RE: Conditional compilation directives
Thanks for the quick response Rubeus.
06-11-2013 07:07 PM
Find all posts by this user Quote this message in a reply
shadow Offline
Member

Post: #4
RE: Conditional compilation directives
EE already has some predefined macros which you can view in the Esenthel headers, such as:
WINDOWS
MAC
ANDROID
IOS
X64
MOBILE

To my knowledge this is the recommended way.
(This post was last modified: 06-17-2013 05:17 PM by shadow.)
06-17-2013 05:16 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #5
RE: Conditional compilation directives
My interest was more in providing conditional compilation to exclude embedded tools code when doing a game release as opposed to conditional compilation to do with platform targets.
06-17-2013 11:35 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #6
RE: Conditional compilation directives
I just put all my configuration and tools/debug info into 2 files. Not the best solution, but it works.
06-18-2013 06:23 AM
Find all posts by this user Quote this message in a reply
shadow Offline
Member

Post: #7
RE: Conditional compilation directives
There is also following macro available:
DEBUG (when in debug mode)

and

const bool EE_RELEASE; (which is always true for publishing)
06-18-2013 07:54 PM
Find all posts by this user Quote this message in a reply
Post Reply