comp.lang.ada
 help / color / mirror / Atom feed
* how do you compile and run ... (hello world)
@ 2014-08-23 13:54 gdotone
  2014-08-23 14:19 ` Dmitry A. Kazakov
  2014-08-23 17:56 ` Jeffrey Carter
  0 siblings, 2 replies; 5+ messages in thread
From: gdotone @ 2014-08-23 13:54 UTC (permalink / raw)


i have downloaded gnat gpl edition from libre.adacore.com

i have installed gnat. it is located /usr/local/gnat/

i have created a file called hello.adb, found in ADA95 textbook,

with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
   Put_Line ("Hello World");
end Hello;

i have cd into /usr/local/gnat/bin
typed:     gnat

and got this 

GNAT GPL 2014 (20140331)
Copyright 1996-2014, Free Software Foundation, Inc.

List of available commands

gnat bind               gnatbind
gnat chop               gnatchop
gnat clean              gnatclean
gnat compile            gnatmake -f -u -c
gnat check              gnatcheck
gnat elim               gnatelim
gnat find               gnatfind
gnat krunch             gnatkr
gnat link               gnatlink
gnat list               gnatls
gnat make               gnatmake
gnat metric             gnatmetric
gnat name               gnatname
gnat preprocess         gnatprep
gnat pretty             gnatpp
gnat stack              gnatstack
gnat stub               gnatstub
gnat test               gnattest
gnat xref               gnatxref

All commands except chop, krunch and preprocess accept project file switches -vPx, -Pprj and -Xnam=val

i then cd back into my home dir :   cd ~ 
where the hello.adb file is located

i entered: gnat compile hello.adb 

i got back:

       gcc -c hello.adb

in the directory i see:

   hello.adb
   hello.ali
   hello.c.save
   hello.o

what do i need to do to run the program ... and compile if i have done something wrong?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how do you compile and run ... (hello world)
  2014-08-23 13:54 how do you compile and run ... (hello world) gdotone
@ 2014-08-23 14:19 ` Dmitry A. Kazakov
  2014-08-23 17:57   ` gdotone
  2014-08-23 17:56 ` Jeffrey Carter
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry A. Kazakov @ 2014-08-23 14:19 UTC (permalink / raw)


On Sat, 23 Aug 2014 06:54:01 -0700 (PDT), gdotone@gmail.com wrote:

> in the directory i see:
> 
>    hello.adb
>    hello.ali
>    hello.c.save
>    hello.o
> 
> what do i need to do to run the program ... and compile if i have done something wrong?

$ gnatmake hello.adb

This [re]compiles, binds and links as necessary.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how do you compile and run ... (hello world)
  2014-08-23 13:54 how do you compile and run ... (hello world) gdotone
  2014-08-23 14:19 ` Dmitry A. Kazakov
@ 2014-08-23 17:56 ` Jeffrey Carter
  2014-08-23 18:14   ` gdotone
  1 sibling, 1 reply; 5+ messages in thread
From: Jeffrey Carter @ 2014-08-23 17:56 UTC (permalink / raw)


On 08/23/2014 06:54 AM, gdotone@gmail.com wrote:
> 
> what do i need to do to run the program ... and compile if i have done something wrong?

You might find it useful to read the top-secret GNAT documentation.

http://docs.adacore.com/gnat-unw-docs/html/gnat_ugn.html

-- 
Jeff Carter
"I feel as though somebody stepped on my tongue
with muddy feet."
Never Give a Sucker an Even Break
112

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how do you compile and run ... (hello world)
  2014-08-23 14:19 ` Dmitry A. Kazakov
@ 2014-08-23 17:57   ` gdotone
  0 siblings, 0 replies; 5+ messages in thread
From: gdotone @ 2014-08-23 17:57 UTC (permalink / raw)


On Saturday, August 23, 2014 10:19:38 AM UTC-4, Dmitry A. Kazakov wrote:

> $ gnatmake hello.adb
>  
> This [re]compiles, binds and links as necessary.
 
> -- 
> Regards,
> 
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thank-you,

g.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how do you compile and run ... (hello world)
  2014-08-23 17:56 ` Jeffrey Carter
@ 2014-08-23 18:14   ` gdotone
  0 siblings, 0 replies; 5+ messages in thread
From: gdotone @ 2014-08-23 18:14 UTC (permalink / raw)


On Saturday, August 23, 2014 1:56:25 PM UTC-4, Jeffrey Carter wrote:

> You might find it useful to read the top-secret GNAT documentation.
> http://docs.adacore.com/gnat-unw-docs/html/gnat_ugn.html
> -- 
> Jeff Carter

actually i should have read past 

You can compile the program using the following command ($ is used as the command prompt in the examples in this document):

 	
$ gcc -c hello.adb

gcc is the command used to run the compiler. This compiler is capable of compiling programs in several languages, including Ada and C. It assumes that you have given it an Ada program if the file extension is either `.ads' or `.adb', and it will then call the GNAT compiler to compile the specified file.

because i got the following error:

   error: invalid value 'ada' in '-x ada'

still do. but Dmitry answer was perfect and worked.

thanks jeff, i will try read that documentation to the end.

hey, but don't go to far though, i'm sure i will have questions. 
this is day one of learning ADA.
i'm using an old book though ada 95 program solving and program design, 2ed.

thanks again,

g.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-23 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 13:54 how do you compile and run ... (hello world) gdotone
2014-08-23 14:19 ` Dmitry A. Kazakov
2014-08-23 17:57   ` gdotone
2014-08-23 17:56 ` Jeffrey Carter
2014-08-23 18:14   ` gdotone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox