Question

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?

Was it helpful?

Solution

Usually, that error is when a missing semicolon after the struct declaration. I don't see one here, however it is possible the next struct is missing its semi colon.

typdef struct{

...


} next_struct <- missing ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top