gcc
is being smart here because you've marked the function as static, meaning that it's expected be defined in this translation unit.
The first thing I'd do is get rid of the static
specifier. This will permit (but not require) you to define it in a different translation unit so gcc
will not be able to complain at the point of compilation.
That may introduce other problems, we'll have to see.