‘setxattr’的声明必须在需要之前从模块‘Darwin.POSIX.sys.xattr’中导入 [英] Declaration of ‘setxattr’ must be imported from module ‘Darwin.POSIX.sys.xattr’ before it is required

查看:32
本文介绍了‘setxattr’的声明必须在需要之前从模块‘Darwin.POSIX.sys.xattr’中导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码在 armv7 上运行良好,但针对 arm64 进行编译时会抛出此必须在需要之前从模块‘Darwin.POSIX.sys.xattr’导入‘setxattr’声明"错误.

code is working fine on armv7 but compile for arm64 throws this "Declaration of ‘setxattr’ must be imported from module ‘Darwin.POSIX.sys.xattr’ before it is required" error.

u_int8_t b = 1;
    setxattr([path fileSystemRepresentation],
             "com.apple.MobileBackup", &b, 1, 0, 0);

有什么帮助吗?

推荐答案

我找到了解决方案.在类中包含#include

I found the solution. include #include <sys/xattr.h> in the class

这篇关于‘setxattr’的声明必须在需要之前从模块‘Darwin.POSIX.sys.xattr’中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆