I’m trying to use Ada to print a class derived from Natural; however, I keep getting the error, prefix of "image" attribute must be a type. Google apparently knows nothing useful about this error.
Here is the simplified code which produced this error:
with Ada.Text_IO;
use Ada.Text_IO;
with Layout; use Layout;
procedure temptest is
term : Terminator_ID;
begin
term := Layout.Block_GetOpposite (1, Layout.REVERSED);
Put_Line (Item => term'Image);
end temptest;
Here is the definition of Terminator_ID in my Layout package:type Terminator_ID is new Natural range 1 .. 40;
What is causing this error and what is the appropriate way to correct it?
Apparently the syntax for converting a number to string is
Type_Name'Image(var_containing_value).I changed my code to:
and it compiles fine now.