Friday, 15 July 2011

android - NDK: Compile c++ files with .mm extension -



android - NDK: Compile c++ files with .mm extension -

i have c++ source files (with .mm extension) in xcode project. i'm trying compile pure c++ (no objc syntax or cocoa runtime used) , compile them in android ndk build (ndk r8d). problem seems g++ not consider .mm files c++ , fail with:

arm-linux-androideabi-g++: error: objective-c++ compiler not installed on scheme

i tried: 1. local_cpp_extension := .mm (in android.mk) - doesn't help. 2. search g++ documentation on how take custom file extensions - couldn't find any.

i'd find way forcefulness ndk/g++ take .mm files, open other ideas like:

copy & rename .mm .cpp android project - don't since complicates build , version control, seems basic thing work. build static lib (using xcode) - tried going there, wasn't sure architecture build for, or if makes sense. others?

does have experience or ideas on this? thanks.

solution (see accepted answer) local_cflags += -x c++

add "-x c++" option $cflags variable in .mk file. should forcefulness gcc utilize c++ compiler.

edit: sorry typo, "-x" option, not "-c" , "c++", not "cpp"

android c++ ios android-ndk g++

No comments:

Post a Comment