现在的位置: 首页 > 综合 > 正文

android NDK开发编译C++文件出现Type ‘jint’ could not be resolved和Unresolved inclusion: 的解决办法

2018年01月11日 ⁄ 综合 ⁄ 共 593字 ⁄ 字号 评论关闭

     今天在编译android NDK工程的时候,在jni文件夹下的cpp文件中报了一大堆错误,诸如:Unresolved inclusion: <jni.h>、Type 'jint' could not be resolved、Type 'jintArray' could not be resolved等,根据经验,这样的错误肯定是没有包含相应的头文件导致的。

        解决方案:

        选中工程,右键->Properties,点击C/C++ General展开,点击Path and Symbols,在右边Includes下,点击Add,把NDK文件夹下的jni头文件和相应的C++头文件添加进来。一定要填写完整的路径,比如我添加的两个路径分别是:

      E:\AndroidNDK\android-ndk-r10c\toolchains\mipsel-linux-android-4.8\prebuilt\windows-x86_64\lib\gcc\mipsel-linux-android\4.8\include

      E:\AndroidNDK\android-ndk-r10c\platforms\android-19\arch-arm\usr\include

      如下图所示:

     大家在自己的NDK文件安装目录下参照我的路径找到相应的include文件夹,添加包含路径,再重新编译,就不会报错了。

抱歉!评论已关闭.