3

I downloaded the Ada language, the GNAT compiler, textwrangler, and xcode on my mac os x version 10.6.8. I am writing Hello World in textwrangler and now need to compile, build, and run the program. This is where I am stuck.

Questions: A: How do I compile and run my simple program? B: Can you show me how to do this via Terminal as well as another option? C: Can/should this all be done through xcode instead?

Here is all of the code I have in the textwrangler document:

WITH Ada.Text_IO; USE Ada.Text_IO; PROCEDURE Hello IS BEGIN Put("Hello World"); END Hello; 

2 Answers 2

2

Like @Den, I often use gnatmake from the command line. For convenience, there's an Ada 05 Language Module for TextWrangler available here.

Addendum: gnatmake also makes a convenient make target, as shown here. I don't use Xcode for Ada, but xcodebuild is handy for integrating projects that do use it.

Sign up to request clarification or add additional context in comments.

Comments

1

This link will answer all your questions: Running a simple ADA program

Save your file with a .adb extension in a convenient place.

you can compile from console either with 'gcc -c yourprog.adb' (which should give you an object file in the same dir) and then do linking with gnat tools.

Best to check out the link above, for more on your installation open your console and type 'info gcc' or 'info gnat' for much detail and concepts if the documentation is available.

I think with Xcode it may be possible to set the compiler in the project prefs.

When I used macs many years ago I think I had Xcode using gcc as the default compiler, if so gcc would recognise the ada extention and hopefully compile.

It would be better to use gnatmake to compile though.

The Xcode IDE is really an interface to the compilers and intended to be the user friendly doitall of programming, especially when it comes to debugging.

However I think for starting out with ada and any programming lang, the text editor and console compile method is a really good place to start at least until you have something serious to debug.

I gave up on Xcode as I always had to fight it to do anything useful and found ides such as eclipse far less complicated and much quicker.

I'm sure there is an ada eclipse plugin out there somewhere.

1 Comment

In answer to C, I don’t believe there’s a current GNAT that integrates with Xcode. Where did you get yours from?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.