What is the difference between "or Body ("Main") use "Sudoku.adb"; and for Main use ("Sudoku.adb");

What is the difference in the .gpr file between:

for Body (“Main”) use “Sudoku.adb”; and
for Main use (“Sudoku.adb”);

With each one apart in the .grp file I get the message:
The Ada project does not define a ‘Main’ attribute.
Debugging is not possible without it. I have the file “Sudoku.adb”
in the same directory as “Sudoku.gpr”.

That “for Body use” should never ever be used? :grinning:

I think that your main (no pun intended) problem is that instead of specifying in gpr what need to be, you throw everything in and then like a sculptor said: “You just chip away everything that doesn’t look like David.”

I already thought so. The point is that however main is defined in the .grp file when run and debug is used I get an error.
On the AdaCore freeware compiler the .gpr did not create an error.On the Visual Studio Code compiler may be other switches necessary.
As for complexity of the .gpr the AdaCore compiler needed them within the .gpr file
It was my intention to compile the program as well on Windows as on Linux and using more routines that can be used in different programs, for instance: more languages, pipes (first in first out), stacks (first in last out) and buffer (random in random out) and standard debuggen tools and so on. I choose Ada because I already had used some of its predecessors (Algol 60 and Pascal) and because in the definition stood,"programs wil be usable on computers without system specific alterations.

Nope. A GtkAda application gpr-file is this:

with "gtkada.gpr";
project Sudoku is
   for Main use ("sudoku.adb");
   package Linker is
      for Default_Switches ("Ada") use ("-mwindows");
   end Linker;
end Sudoku;

Dimitry,

I tried your solution, it did not work. I have a number of .adb and .ads files in the same directory, including the Sudoku.adb. As long as I have my with and
use statements only as text lines I donot see the fault. It appears if one of the with statement changes from text to a program line. Herewith the listing of Sudoku.adb
with gtkada;

pragma License(Unrestricted);

–with Gtk; use Gtk;
–with Gtk.Main;
–with Gtk.Widget; use Gtk.Widget;
–with Ada.Directories; use Ada.Directories;
–with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
–with Program_Init; use Program_Init;
–with Sudoku_Main_Init; use Sudoku_Main_Init;
–with Sudoku_General; use Sudoku_General;
–with Sudoku_Languages; use Sudoku_Languages;

procedure Sudoku is
begin
n_ini := 2;
n_ini := Use_File(“Sudoku”);
Box_H := Get_Value(n_ini, “Grid”, “H”, 3);
Box_V := Get_Value(n_ini, “Grid”, “V”, 3);
mark := Get_Value(n_ini, “Mark”, “Pencil”, false);
for n in 1 .. 12 loop
Tech(n) := Get_Value(n_ini, “Technique”, integer’image(n), true);
end loop;
Number := Box_H * Box_V;
Lan :=Language’Value(Get_Value(n_ini, “Languages”, “Lan”,
Language’Image(GB_USA)));
Cur_Folder := To_Unbounded_String(Current_Directory & “*.*”);
Inp_Folder := To_Unbounded_String(Get_Value(n_ini, “Directory”, “Input”,
To_String(Cur_Folder)));
Out_Folder := To_Unbounded_String(Get_Value(n_ini, “Directory”, “Output”,
To_String(Inp_Folder)));
Diagonal_mode := Get_Value(n_ini, “Options”, “Diagonals”, False);
Gray_Square_mode := Get_Value(n_ini, “Options”, “Gray_Square”, False);
Gtk.Main.Init;
Gtk_New (Main_Window);
Main_Window.Show_All;
Gtk.Main.Main;
end Sudoku;

Start with Hello-world:

hello.adb-----------------------------------------------------------

with Gtk.Label;    use Gtk.Label;
with Gtk.Window;   use Gtk.Window;
with Gtk.Widget;   use Gtk.Widget;
with Gtk.Table;    use Gtk.Table;

with Ada.Unchecked_Conversion;
with Gdk.Event;
with Gtk.Main;

procedure Hello is
   Window : Gtk_Window;
   Grid   : Gtk_Table;
   Label  : Gtk_Label;

   type Event_Callback is not null access function
        (  Self  : access Gtk_Widget_Record'Class;
           Event : Gdk.Event.Gdk_Event
        )  return Boolean;
   function "+" is
      new Ada.Unchecked_Conversion
          (  Event_Callback,
             Cb_Gtk_Widget_Gdk_Event_Boolean
          );
   type Destroy_Callback is access procedure
        (  Widget : access Gtk_Widget_Record'Class
        );
   function "+" is
      new Ada.Unchecked_Conversion
          (  Destroy_Callback,
             Cb_Gtk_Widget_Void
          );

   function Delete_Event_Handler
            (  Widget : access Gtk_Widget_Record'Class;
               Event  : Gdk.Event.Gdk_Event
            )  return Boolean is
   begin
      return False;
   end Delete_Event_Handler;

   procedure Destroy_Handler
             (  Widget : access Gtk_Widget_Record'Class
             )  is
   begin
      Gtk.Main.Main_Quit;
   end Destroy_Handler;
begin
   Gtk.Main.Init;
   Gtk.Window.Gtk_New (Window);
   Window.Set_Title ("Hello World");
   Window.On_Delete_Event (+Delete_Event_Handler'Access);
   Window.On_Destroy (+Destroy_Handler'Access);

   Gtk_New (Grid, 1, 1, False);
   Window.Add (Grid);
   Gtk_New (Label);
   Label.Set_Text ("Hello World!");
   Grid.Attach (Label, 0, 1, 0, 1);
   Label.Show;

   Grid.Show;
   Window.Show;

   Gtk.Main.Main;
end Hello;

hello.gpr--------------------------------

with "gtkada.gpr";
project Hello is
   for Main use ("hello.adb");
   package Linker is
      for Default_Switches ("Ada") use ("-mwindows");
   end Linker;
end Hello;