Skip to content

Common Decomp Errors (and How to Solve Them)

ravepossum edited this page Feb 19, 2024 · 4 revisions

Intro

This page will discuss some common errors that occur when working on the pokeemerald decomp. I'll dissect the meaning and explain the ways in which they're typically addressed.

Table of Contents

Alternatively, Ctrl+F for a small part of your error message.


Identifier Undeclared

Example

src/battle_script_commands.c: In function `Cmd_moveend':
src/battle_script_commands.c:5535: `BattleScript_MyNewEffect' undeclared (first use in this function)
src/battle_script_commands.c:5535: (Each undeclared identifier is reported only once
src/battle_script_commands.c:5535: for each function it appears in.

Meaning

This means the function or variable mentioned is not recognized by the compiler. This could be for a handful of reasons like:

  • A typo in the name
  • Never declaring the function
  • Not including the right header file

Potential Solutions

  • Double check the function or variable name for typos anywhere it is mentioned
  • If this is in code you found elsewhere (via git pull or copy/paste for example), make sure you also find the declaration and definition in the source and place that in your code as well.
  • Find the header (.h) file the function or variable is declared in and add an include statement for it at the top of your .c file: #include "<file_name>" where <file_name> is the relevant header file's name.

Multiple Definitions

Example

src/data/object_events/berry_tree_graphics_tables.h:85: redefinition of gBerryTreePaletteTagTable_Pecha'
src/data/object_events/berry_tree_graphics_tables.h:1: gBerryTreePaletteTagTable_Pecha' previously defined here

Meaning

This means you're defining a function or variable more than once (you can only have definition per declaration). The most common reasons this occurs are:

  • Copy/paste errors or typos
  • Including a .c file or the same .h file twice
  • Writing a .h file without header guards

Potential Solutions

  • Double check that you haven't pasted or merged in a 2nd definition of a function or variable
  • Never #include a .c file. If you need to use a function in that file, include the corresponding .h file.
  • Make sure all new .h files have header guards.

Excess Elements in Scalar Initializer

Example

src/ui_test.c:38: warning: excess elements in scalar initializer after `gCursorGfx'
src/ui_test.c:39: warning: excess elements in scalar initializer after `gCursorPal'

Meaning

This means you're trying to assign an array to a variable that isn't an array.

Potential Solutions

  • Add [] to the variable definition, like: u16 gCursorGfx[] instead of u16 gCursorGfx.

Excess Elements in Array Initializer

Example

src/data/pokemon/evolution.h:224: warning: excess elements in array initializer after `gEvolutionTable[133]'

Meaning

This means your array has a fixed size, but you've added elements to it so it exceeds the fixed size.

Potential Solutions

  • If the array size is tied to a constant e.g [SPECIES_COUNT], ensure you modify the constant to account for your additions.
  • If the array size is tied to a hardcoded number e.g. [4], simply increase the hardcoded value.

Unsupported Color Type

Example

"graphics/battle_interface/ball_display.png" has an unsupported color type.
The image "graphics/battle_interface/ball_display.png" does not contain a palette.
make: *** [Makefile:330: graphics/battle_interface/ball_display.4bpp] Error 1

Meaning

This means you're trying to use an image that is not indexed properly.

Potential Solutions

Go back to your graphics editor of choice and make sure the color mode of the image is saved as "indexed."