【发布时间】:2011-04-12 17:40:22
【问题描述】:
我构建了一个使用 ndk 和 JNI 的简单 android 应用程序。 该应用程序具有用于将 java 和 c++ 与 jni 链接的 onw .cpp(debugTest.cpp) 文件和另一个 .c(javaEssentials.c) 文件及其标头 (javaEssentials.h)。 当我在 .cpp 文件中包含 .c 文件(#include "javaEssentials.c") 时,编译时不会报告错误。 当我在 .cpp 文件中包含标头时,编译器报告 .c 文件具有的函数的未定义引用错误。这是一个真正奇怪的问题,我不明白为什么会这样。 像往常一样,我在 .c 文件中有一个头文件的包含声明。
我的 android.mk 是:
# build file written to describe the C and C++ source files to the Android NDK
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := debugTest
LOCAL_SRC_FILES := debugTest.cpp
include $(BUILD_SHARED_LIBRARY)
任何想法为什么会发生这种情况?
【问题讨论】:
标签: android header include java-native-interface android-ndk