当前位置: 代码迷 >> Android >> undefined reference to `android_log_print'
  详细解决方案

undefined reference to `android_log_print'

热度:32   发布时间:2016-05-01 16:34:27.0
undefined reference to `__android_log_print'

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

出错时:

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>

  相关解决方案