If a compilation causes such an error and works correctly in other tools, then I suspect a problem with the "debug information" mode. To verify this, go to Tools > Preferences > Debugger tab page, disable the "Add debug information when compiling" option, and retry the compilation.
You can also explicitly exclude specific objects from debug information. On the same debugger tab page you can add a line with the name (or owner.name) of the program unit to the "NEVER add debug info for objects" list.