FAQ Database Discussion Community


Ada for loop isn't doing correct comparison

loops,for-loop,ada,gnat,ada2012
The simple program is to match the best candidate for a voter with several candidates. There are 10 imaginary topics which the imaginary voter answered; a "-1" means disagreement, a "0" means doesn't care, a "1" means agreement. The candidates also took the same survey on the same topics, and...

Missing “.ali” files when using gnatmake on Mac OS X

osx-yosemite,ada,gnat
What is causing this error? I can't compile Ada .adb files. I have /usr/local/gnat/bin in my path. Output error: gnatmake -d -P/Users/u0/Downloads/test.gpr Adding linker switches for"test.adb". Adding -g TMPDIR = "/private/var/folders/fn/srvkxbdj3bz60q952680ngj40000gn/T" Created configuration file "/private/var/folders/fn/srvkxbdj3bz60q952680ngj40000gn/T/GNAT-TEMP-000001.TMP" "test.ali" being checked ... -> "test.ali" missing. gcc -c -g -gnatf -g -gnat12 -I- -gnatA...

What caused this Ada compilation error “ambiguous character literal”?

ada,gnat
I have this Ada code. with Ada.Text_IO; use Ada.Text_IO; procedure for_Loop is begin for Counter in 'A'..'Z' loop Put(Counter); end loop; New_Line; end for_Loop; The Ada compiler (gnatmake) outputs these error message. gcc -c for_loop.adb for_loop.adb:6:24: ambiguous character literal for_loop.adb:6:24: possible interpretation: Character for_loop.adb:6:24: possible interpretation: Wide_Character for_loop.adb:6:24: possible interpretation:...

CONSTRAINT_ERROR on reading a file containing “[”

ada,gnat
I am reading a simple text file. Everything works as it should, except when an open bracket ("[") character is encountered. Then I get a CONSTRAINT_ERROR. My function is: ---------------------------------------------- -- GET_FILE_CONTENTS function Get_File_Contents (File_Name : in String) return String_Array is -- Loads the entire file into a dynamically sized...

Maximum size/offset of streamed File using Ada.Streams.Stream_IO.Read

io,filestream,ada,gnat
I try to read specific blocks of Data (around 4096 bytes) from a (possibly) huge file. Using Ada.Streams.Stream_IO.Read() with the GNAT compiler, what would be the maximum offset that I could use? That is, if I wanted to read the last 4 kilobytes of the file, using type Block_Array is...