I’m running Mac OS X v10.8 (Mountain Lion) with Xcode 4.5.1 with command line tools.
I have just installed GNAT 2012 from here.
I installed it using this tutorial:
Navigate to the directory that contains a file called: doinstall
Enter: sudo mkdir /usr/loca/gnat You will have to enter your password
Enter: sudo ./doinstall Press return and y as prompted Update your
path: sudo export PATH=/usr/local/gnat/bin:$PATH You should now be
able to compile using the command gnatmake
Everything went fine and I restarted. On my desktop I have file hello.adb:
with Ada.Text_IO;use Ada.Text_IO;
procedure Hello is
begin
Put_Line ("Hello, World!");
end Hello;
And in terminal I navigate to my desktop and execute the gnatmake hello.adb. But I get this
-bash: gnatmake: command not found
But in the terminal, if I execute info gnat, I get a very large documentation file.
- Why can’t I compile hello.adb? Is there a way to fix it?
- Can I create Ada projects and compile/debug within Xcode? I would like to edit the source files using Xcode as the IDE. If so, what type of project shall I use? "external build system" perhaps?
What could a tutorial be on how to run a Hello, World! application using Xcode? Video would be great. It is such a pity that Ada has few little resources on the Internet.
You need to put the path to Ada in a more permanent place. The command you entered in your Terminal only lasts for as long as the terminal is open.
Open the $HOME/.bash_profile file and add
You can open the file from Terminal with either
or
If you’re using Z shell (executable
zsh), place theexportline in the $HOME/.zshrc file.For #2, I can’t find an updated Xcode plugin, but if you want an IDE, check out this top answer.