android ndk添加打印 解决undefined reference to __android_log_print'问题
2014-02-21 19:45
525 查看
在so库中添加打印,android虚拟机不能打印的问题,网上答案太多,一个个试出来的,先记录下来
用的是android-ndk-r8c
遇到的一个问题 用了stdio.h中的printf()添加打印后,在虚拟机中打印不能输出
需要引用库,添加 几个地方才能打开打印
#include <android/log.h>
定义宏
ndk-build编译
发现这个修改之后会出现undefined reference to __android_log_print' 这个问题
然后继续修改Android.mk文件
需要加上几句话
LOCAL_LDLIBS := -lm -llog
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
LOCAL_SHARED_LIBRARIES :=\
liblog.so\
libutils \
搞定
用的是android-ndk-r8c
遇到的一个问题 用了stdio.h中的printf()添加打印后,在虚拟机中打印不能输出
需要引用库,添加 几个地方才能打开打印
#include <android/log.h>
定义宏
#define LOG_TAG "communicate" #define LOGI(args...) \ __android_log_print(ANDROID_LOG_INFO,LOG_TAG, args) #define DEBUG(args...) \ __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, args) #define ERROR(args...) \ __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, args) #else #define LOGI(args...) #define DEBUG(args...) #define ERROR(args...) #endif
ndk-build编译
发现这个修改之后会出现undefined reference to __android_log_print' 这个问题
然后继续修改Android.mk文件
需要加上几句话
LOCAL_LDLIBS := -lm -llog
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
LOCAL_SHARED_LIBRARIES :=\
liblog.so\
libutils \
搞定
相关文章推荐
- jni编译问题:jin中添加LOG方法以及undefined reference to `__android_log_print'错误
- 问题“undefined reference to `android_log_print”的解决办法
- Visual GDB进行Android NDK开发,报错:error : undefined reference to '__android_log_print' 解决办法
- undefined reference to '__android_log_print' 的解决
- undefined reference to `__android_log_print'解决
- 解决Error: undefined reference to `__android_log_print'
- 关于android底层库编译出现“undefined reference to `__android_log_print'”的解决方法
- undefined reference to `__android_log_print'解决
- Android NDK 编译时候出现 undefined reference to `__android_log_print
- undefined reference to `__android_log_print'解决
- Error:(606) undefined reference to `__android_log_print'解决办法
- undefined reference to `__android_log_print'解决
- JNI编程-- undefined reference to `__android_log_print' 的解决办法
- "android-studio undefined reference to `__android_log_print "错误解决方法
- undefined reference to `__android_log_print'解决
- undefined reference to `log' 问题解决
- undefined reference to __android_log_print
- 安卓 jni 开发错误 undefined reference to __android_log_print
- 解决undefined reference to `log' 的问题
- 使用android studio JNI报错 undefined reference to '__android_log_print'