I'm trying to call a C function foo() from a JNI native-lib.cpp file. foo() is declared in foo.h and defined in foo.c. native-lib.cpp already included "foo.h", so Android Studio seems to recognize that the function exists, but upon build, I get the following error:
error: undefined reference to 'foo(unsigned char const*, unsigned int*, int)'
foo() is declared as such in foo.h:
void foo(const unsigned char key[], unsigned int w[], int keysize);
foo() is called in native-lib.cpp as follows:
static unsigned char byteArray[32];
unsigned int intArray[64];
foo(byteArray, intArray, 256);
Am I missing anything? Why am I getting the error?
I also notice that when I open my foo.c, Android Studio informs me that "This file is not part of the project. Please include it in the appropriate build file (build.gradle, CMakeLists.txt or Android.mk etc.) and sync the project." How do I do that?