【ndk开发】undefined reference to `android_log_print'

来源:互联网 发布:微分方程数值算法 编辑:程序博客网 时间:2024/05/19 02:42

原因:没有加入支持的共享库

出错时:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := testlog
LOCAL_SRC_FILES := testlog.c

include $(BUILD_SHARED_LIBRARY)

 

.c的头文件

#include <string.h>
#include <jni.h>
#include <android/log.h>

 

调试好的:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := testlog
LOCAL_SRC_FILES := testlog.c
LOCAL_LDLIBS    := -llog
include $(BUILD_SHARED_LIBRARY)

.c的头文件

#include <string.h>
#include <jni.h>
#include <android/log.h>

0 1