解决Error: undefined reference to `__android_log_print'
最近在使用Android Studio进行NDK开发时,程序本身是没有问题,但一旦添加了Android的NDK调试信息,就报如下的错:
在旧的Android Studio版本中,一般是在build.gradle中修改,但新版本了换为了CMakeLists.txt:需要这样修改:即新增“log-lib”
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
target_link_libraries( # Specifies the target library.
imagePro-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )