我正在尝试使用OSX交叉编译应用程序.但是,当我编译我得到以下内容
Fatal error: 'linux/types.h' file not found
当我更改为sys / types.h,现在我得到…
error: unkNown type name '__s32' unkNown type name '__u8' unkNown type name '__u16' etc
有人可以帮我解决这个问题吗?
解决方法
显然,一个Linux特定的头文件不会出现在MacOS / X下,这不是基于Linux的.
解决问题的最简单的办法是通过你的程序来替换所有的实例
#include "linux/types.h"
有了这个:
#include "my_linux_types.h"
…并写入一个名为my_linux_types.h的新头文件,并将其添加到您的项目中;它会看起来像这样:
#ifndef my_linux_types_h #define my_linux_types_h #ifdef __linux__ # include "linux/types.h" #else # include <stdint.h> typedef int32_t __s32; typedef uint8_t __u8; typedef uint16_t __u16; [... and so on for whatever other types your program uses ...] #endif #endif
原文地址:https://www.jb51.cc/c/113005.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。