davidcallanan / os-series

818 stars 119 forks source link

compiler error #26

Closed UFifty50 closed 3 years ago

UFifty50 commented 3 years ago

When I try to compile the source it gives me this error:

x86_64/print.c:11:1: error: expected ';', identifier or '(' before 'struct'
 struct Char* buffer = (struct Char*) 0xb8000;

the command being run:

x86_64-elf-gcc -c -std=gnu99 -I include/ -ffreestanding  x86_64/print.c -o build/x86_64/print.o

the relevant contents of print.c:

struct Char {
        uint8_t character;
        uint8_t colour;
}

struct Char* buffer = (struct Char*) 0xb8000;

my gcc version is a cross-compiled 4.9.0, however i get the exact same error on non-cross-compiled versions 4.7, 7, 9 and 10. any help would be appreciated!

0f-0b commented 3 years ago

A semicolon is required after the class specifier, since it is part of a declaration.

 struct Char {
         uint8_t character;
         uint8_t colour;
-}
+};

 struct Char* buffer = (struct Char*) 0xb8000;
UFifty50 commented 3 years ago

Perfect, that worked! thanks :)