JNI中cpp文件编写,解决Unresolved inclusion问题

本文介绍了在JNI编程中遇到cpp文件的Unresolved inclusion问题,并提供了解决方案。内容涉及头文件的引用,以及stat、fstat、lstat等函数的使用,帮助开发者理解如何正确处理此类编译错误。
摘要由CSDN通过智能技术生成
1. 头文件
#include <jni.h>
#include "Symbol.h"
#include "yoyon_types.h"
#include <android/log.h>
#include <stdarg.h>    //主要目的为让函数能够接收可变参数。
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>  //stat函数可以返回一个结构,里面包括文件的全部属性。
#include <string.h>                   
Unresolved inclusion错误:
原因是在eclipse编辑环境中没有找到对应的include中的文件。解决方法是将包含该文件的include目录作为新的linked folder加入工程中。具体方法如下:
1. 右击工程->New->Folder
2. 对话框中点击Advanced
3. 选择Link to alternate location (Linked Folder),选择需要的include目录,例如:/android-ndk-r7b/platforms/android-8/arch-arm/usr/include
4. Finish后刷新工程,问题解决。

1.1) #include <sys/stat.h>  调用linux的stat.h头文件,stat函数可以返回一个结构,里面包括文件的全部属性。

#i nclude<sys/stat.h>
int stat(const char *restrict pathname,struct stat *restrict buf);
int fstat(int fields,struct stat *buf);
int ls

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值