undefined reference to `__android_log_print'

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介:

原文:http://yfxuchao.iteye.com/blog/949198


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

出错时:

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>


相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
619 0
解决办法:undefined reference to symbol 'shm_open@@GLIBC_2.2.5'
解决办法:undefined reference to symbol 'shm_open@@GLIBC_2.2.5'
398 0
|
Linux C语言 计算机视觉
OpenIN2 Linux 编译OpenCV 报错undefined reference to `xxx@xxx‘
OpenIN2 Linux 编译OpenCV 报错undefined reference to `xxx@xxx‘
342 0
OpenIN2 Linux 编译OpenCV 报错undefined reference to `xxx@xxx‘
NullPointerException:method 'android.content.BroadcastReceiver.onReceive' on a null object reference
NullPointerException:method 'android.content.BroadcastReceiver.onReceive' on a null object reference
|
Ubuntu C语言
【ubuntu】2.c:(.text+0xd2): undefined reference to `pthread_create‘ collect2: error: ld returned
【ubuntu】2.c:(.text+0xd2): undefined reference to `pthread_create‘ collect2: error: ld returned
148 0
undefined reference to `major‘
undefined reference to `major‘
281 0
undefined reference to `gdk_monitor_get_scale_factor/gtk_widget_get_scale_factor‘
undefined reference to `gdk_monitor_get_scale_factor/gtk_widget_get_scale_factor‘
96 0
|
C++
undefined reference to `vtable for XXX‘
undefined reference to `vtable for XXX‘
186 0
NDK编译doubango时出现错误:undefined reference to ‘stderr‘
NDK编译doubango时出现错误:undefined reference to ‘stderr‘
140 0