"u8"未在此范围内声明

"u8" was not declared in this scope

本文关键字:范围内 声明 u8      更新时间:2023-10-16

我正在研究覆盆子派和红隼板(来自procerus technologies(之间的通信。现在,我需要从红隼的包装中接收信息,为此我使用的是 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;
u8不在

标准中,但uint8_t在标准中(包含在stdint.hcstdint中(。检查您的包含,验证您是否在某处定义了u8

我正在查看<linux/types.h>内核标头,但找不到u8.有一个__u8通过<asm/types.h>拉入,通过另外两层内含物。

如果我编译

#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;
^~
__u8