Reputation: 1129
I am trying to integrate a c++ library I've created for iOS into an android project that uses the NDK to build .cpp files. My problem is that in iOS, I can include files using :
#include "MyFile.h"
Which works just fine, regardless of where these files are placed, provided that I link it to my Xcode project.
However, if I place the files using their normal file structure, including a .h that is not in the same file requires a relative url. Something along the lines of :
#include "../MyOtherFolder/MyOtherFile.h".
Is there a way to mimic the Xcode behaviour (flat file hierarchie) using Android Studio? Perhaps there is a setting / flag to be specified in the build.gradle file?
Thanks!
Upvotes: 0
Views: 168
Reputation: 14463
You can explicitly add other include directories to be considered by Android Studio using cFlags/cppFlags.
For example:
android.ndk {
moduleName = "mymodule"
//...
cppFlags += "-I${file("src/main/jni/MyOtherFolder")}".toString()
//...
}
Upvotes: 1