Most of the time when I see that error it is applied to a spec file where I declare a function but don’t have a body for it. I’ve not seen it applied to a body file, so not sure. Maybe check and see if you have any function declarations and if you do, then double/triple check the bodies for them to make sure the signatures match. Maybe a parameter or return type is off by mistake.
GNAT gives this message if you try to compile a package spec that needs a body or a separate subunit. As the message says, you’re trying to compile a subunit. You can use --gnatc to check such units.
With most other compilers you can and must compile such units.