1

I am an OS developer and I would like to compile the following (it's in the file cpu.h) with my gcc crosscompiler(ver= 4.5.4)

#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

but unfortunally it says:

HAL/x86_64/cpu.h:4:1: error: two or more data types in declaration specifiers

What am I doing wrong?

4

1 回答 1

2

通常,该错误是在结构声明后缺少分号时出现的。我在这里看不到一个,但是下一个结构可能缺少分号。

typdef struct{

...


} next_struct <- missing ;
于 2013-07-16T17:20:54.697 回答