当前位置:   article > 正文

ndk cmake ‘jni.h‘ file not found 问题解决_android studio cmake jni,h not file found

android studio cmake jni,h not file found

最近写ndk代码时报头文件找不到的错

报错图如下:

解决办法是用cmake引入nkd头文件

include_directories(E/work/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include)
  1. #指定CMake构建本地库时所需的最小版本
  2. cmake_minimum_required(VERSION 3.4.1)
  3. include_directories(E/work/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include)
  4. add_library( # Sets the name of the library. 将资源文件生成动态链接库(so文件)的库名称(文件名称:“lib" +设置的名称)
  5. hello
  6. # Sets the library as a shared library.
  7. SHARED
  8. # Provides a relative path to your source file(s).资源文件(C或C++)的相对位置
  9. src/main/jni/NativeConvertUtil.cpp
  10. src/main/jni/Test.cpp
  11. )
  12. find_library( # Sets the name of the path variable.
  13. log-lib
  14. # Specifies the name of the NDK library that
  15. # you want CMake to locate.
  16. log )
  17. target_link_libraries( # Specifies the target library.将所有的add_library中的库链接起来,有多少个add_library成的库就将其添加到这里
  18. hello #这个和add_library中的指定的so库名称一致
  19. # Links the target library to the log library
  20. # included in the NDK.
  21. ${log-lib} )

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/158512
推荐阅读
相关标签
  

闽ICP备14008679号