我是一名操作系统开发人员,我想用我的gcc crosscompiler(ver = 4.5.4)编译以下文件(在文件cpu.h中)
#ifndef X86_64_CPU_H
#define X86_64_CPU_H
#include<stdint.h>
typedef struct
{
// manually secured registers
uint64_t rax;
uint64_t rbx;
uint64_t rcx;
uint64_t rdx;
uint64_t rsi;
uint64_t rdi;
uint64_t rbp;
uint64_t r8;
uint64_t r9;
uint64_t r10;
uint64_t r11;
uint64_t r12;
uint64_t r13;
uint64_t r14;
uint64_t r15;
uint64_t intr;
uint64_t error;
// secured by cpu
uint64_t rip;
uint64_t cs;
uint64_t rflags;
uint64_t rsp;
uint64_t ss;
} cpu_state;
...
#endif
但不幸的是它说:
HAL / x86_64 / cpu.h:4:1:错误:声明说明符中的两个或更多数据类型
我做错了什么?
答案 0 :(得分:2)
通常,该错误是在struct声明后缺少分号。我在这里看不到一个,但是下一个结构可能缺少它的半冒号。
typdef struct{
...
} next_struct <- missing ;