我正在研究树莓派和红雀盘(来自procerus technologies)之间的通信。现在,我需要从kestrel的包中接收信息,为此我使用了Gumstix中使用的旧代码。在编译的时候,它给出了标题的错误("u8“没有在这个作用域中声明)。错误出现在多个文件中。例如
我认为这个错误与Linux版本有关
#include "dllsetup.h"
#include "type.h"
#include <vector>
#include <linux/types.h>
#include <asm/types.h>
#include <sys/types.h>
#ifndef LINUX
EXTERN_LINK template class DYNAMIC_LINK std::vector<u8>;
#endif
//! Packet Data Type defines for easy writing of code.
typedef std::vector<u8> PacketData;
typedef std::vector<u8>::iterator PacketDataIter;发布于 2019-07-18 02:20:04
u8不在标准中,但uint8_t在标准中(包括在stdint.h和cstdint中)。检查您的includes,验证您是否在某个地方定义了u8。
发布于 2019-07-18 02:33:15
我正在查看<linux/types.h>内核头文件,但是找不到u8。通过另外两层包含,有一个通过<asm/types.h>拉入的__u8。
如果我编译
#include <linux/types.h>
u8 u;在带有gcc-7.3.0的Ubuntu 18上,它建议这样做。
test.c:2:1: error: unknown type name ‘u8’; did you mean ‘__u8’?
u8 u;
^~
__u8https://stackoverflow.com/questions/57082030
复制相似问题