How to compile/build ada in Mac?
Frage
Im running Mac OS X 10.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. In my desktop I have 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 terminal If I execute info gnat
I get a very large documentation.
- Why cant I compile hello.adb? Anyway to fix?
- 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? Could somebody please post a tutorial on how to run a hello world using xcode? It would help me a lot. Video would be great. such a pity that Ada has so little resources on the internet.
Lösung
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 ~/.bash_profile
and add
export PATH=/usr/local/gnat/bin:$PATH
You can open the file from Terminal with either
nano ~/.bashrc
or
vim ~/.bashrc
If you're using ZSH, place the export
line in ~/.zshrc
.
EDIT: For #2, I can't find an updated XCode plugin, but if you want an IDE, check out this top answer.