未在此范围内声明“ u8”

时间:2019-07-17 18:16:23

标签: c++ raspberry-pi3 raspbian

我正在研究树莓派和茶est板之间的通讯(来自Procerus技术)。现在,我需要从茶est的包装中接收信息,为此,我正在使用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;

2 个答案:

答案 0 :(得分:1)

u8不是标准,但是{​​{1}}(包含在uint8_tstdint.h中)。检查您的包含,确认您在某处定义了cstdint

答案 1 :(得分:0)

我正在查看<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