I am new to Android NDK and I am trying to understand it. So far I discovered that every example in the NDK/samples folder is written in C, not C++. Everything works fine when I import those projects and work on them. However when I create new project in Eclipse and then right-click on the project -> Android Tools -> Add Native Support it always creates the libname.cpp file. Naturally the c code doesn't compile after copying into .cpp file.
I've also tried to replace nativetest.cpp
with nativetest.c
in the following lines in the Android.mk file
LOCAL_MODULE := nativetest
LOCAL_SRC_FILES := nativetest.cpp
but it produced this error:
No rule to make target `jni/nativetest.c', needed by `obj/local/armeabi/objs/nativetest/nativetest.o'. Stop.
My question is: how can i add native support for .c files?