Beginning an odyssey into Ada and . .

(Using the book Ada – A Crash Course together with gnat 12.2.0 on a Devuan box.)

The first exercise (pg 4) is the classic Hello world program.

with Ada.Text_IO; use Ada.Text_IO;

procedure Hello.abd is
begin
Put_Line(“Hello, Ada”);
end Hello.abd;>

gets me

$ gnatmake hello.abd
x86_64-linux-gnu-gcc-12 -c -x ada hello.abd
hello.abd:4:16: warning: file name does not match unit name, should be “hello-abd.adb” [enabled by default]
hello.abd:4:16: error: file “hello.ads” not found
gnatmake: “hello.abd” compilation error>

and

$ ls
hello hello1.abd hello.abd hello.ali hello.o>

(Am I allowed to say i hate markup!!)

So - - - - being a total noob effectively knowing absolutely nothing - - -
what’s going on?
What am I supposed to be doing?
(Is this text perhaps not a good learning manual?)

Please advise.

TIA

1 Like

Welcome to the Ada community!

It seems you had a typo writing the file extension, and after that, you changed the name of the procedure from Hello to Hello.abd and made the compiler more confused. The filename should be hello.adb but you named it hello.abd. In fact, adb is the extension used by the GNAT compiler to name Ada bodies (that can be the mnemonic to help you remember the correct spelling).

After naming the procedure Hello.abd, the syntax is telling the compiler that this is a procedure named abd inside the parent package Hello and that’s why it tries to find the specification of that package in hello.ads (ads meaning Ada specification).

Hmmmmmmmm so what’s the fix?

Change the line
procedure Hello.abd is
to
procedure hello is
???

did that - - - successful

Thanks a muchly!

Yes. You’re wrong, but you’re allowed to say it. :grin:

well - - - - I prefer to use a clear writing style and not be forced to click here and there and fiddle with this and that but I suppose that programmers are not considered capable of using a clear writing style so one is imposed on them - - - yes?

I thought the :grin: made it clear that I was being light-hearted, but looking at your post again: it’s a “simple” matter of using triple back-ticks to start (the ` symbol, three times), moving to a new line, typing or pasting Ada to your heart’s content, moving to a new line, and using triple back-ticks again. No need to click or fiddle with anything. Like this:

I type ```, then move to a new line and type.
After writing this line I will move to a new line and type ``` again, hit Enter one more time, and voila.

LOL - - - - markup as a concept reminds me of this cartoon where there are some 14 standards. So the desire is create another standard to fix the issue.
Then there are 15 standards.

Grin - - - somehow I think that a " on either side of something means that its a
quote - - - that’s only 2 keystrokes each time too.

(Just finding this universe called programming sorta ‘different’ you know - - - lots of pertending to be logical - - - you know like starting one’s count at 0 and yet in the end arriving at something that definitely isn’t a mathematically provable construct (as I remember reading about back in the early 80’s in one issue of Byte magazine).)

(Oh well - - - my humor is considered on the weird side by most around me so its likely that what I wrote wouldn’t be considered light hearted either - - - grin!)

Yes. The markup isn’t for you, it’s for readers

I don’t know the book you mentioned, but I found the following introduction helpful to get started.

HTH

He’s referring to this book:

If you’re completely new to Ada, I found this book to be a very helpful introduction as well:

Might it be your naming? Try: procedure hello_world is
begin
put_line (“Hello from Ada”);
end Hello_world;

What is the *.abd suffex? Do you mean *.adb for a package body? Also the compiler is complaint that it cannot find the *.ads, the package specification file for (the package containing the procedure hello_world. I would say start putting everting into your own created packages, and use ‘with’ and ‘use’ as needed for basic Ada functionality. As in Pascal, you predefine things in a *.ads file and then put the corresponding bodies (the how) into a separate *.adb (package body) file.