2011年3月2日 星期三

[Android] Preprocessor definition in NDK

http://stackoverflow.com/questions/4022180/how-to-add-a-custom-macro-when-using-ndk

If you would like to add a special definition when compiling your NDK code (jni) add the following into your Android.mk:

LOCAL_CFLAGS:=-DMYDEFINE

This will define the Macro MYDEFINE in your c/c++ code. Here an example

#ifdef MYDEFINE
// We build the project with this special macro
#else
// We build without setting the macro in the LOCAL_CFLAGS
#endif

沒有留言:

張貼留言