• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other] Pokeemerald: Errors when creating new .h and .c file, doesn't recognise s8/u8/u16?

ellabrella

PKMN Trainer
  • 57
    Posts
    6
    Years
    • She/It
    • Seen Feb 27, 2025
    hi all,

    i'm adding a new .h and .c file to my pokeemerald project. the files are pretty simple; the .h file has an include guard, an enum, some structs, some extern const arrays and a function declaration. the .c file contains the definition for those const arrays (included as a src/data file; i get the same issue even if i don't include it so i don't think that file has any issues) and the function. the .h file is included by a few files that reference its variables. i am pretty much certain that there are no syntax errors or typos, no semicolons in the wrong place or anything like that, and to my knowledge nothing i've written outside functions is anything which wouldn't be allowed, as it's all just variable stuff.

    whenever i compile it, no matter what i try to do, i get a ton of errors and warnings. they say things like "syntax error before s8" or "before [variable name]", "array assumed to have one element", and "type defaults to int". it seems like all the errors are in places where i've written "s8" or "u8" or "u16". when i change the first instance of s8 to "int" instead, the first error goes away, and it complains about the next line's s8 instead. also, if i include graphics.h in my .c file, i start getting these same errors about variables in THAT file as well.

    so it seems like my file just doesn't recognise the variable types that pokeemerald uses. does anyone have a guess as to why this would be? is there something in particular i have to do when adding a new file like this to get it to work?

    i have pastebin links for the include/mix_mega.h and src/mix_mega.c files, i didn't include the src/data/mix_mega.h file as it is very large and doesn't seem to be relevant anyway.
    src/mix_mega.c: https://pastebin.com/0a7f06xX
    include/mix_mega.h: https://pastebin.com/Ja5Tx60Y
     
    You have not included gba/types.h, which defines all of these data types. Generally, you should include global.h or at least gba/gba.h in your files, as these account for including gba/types.h, as well as cover a lot of basic definitions that are used a lot across a lot of different files.
     
    that was exactly the problem, thanks! that's very useful to know.
     
    Back
    Top