comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Can't create executable file.
Date: Thu, 06 Mar 2014 15:45:59 -0500
Date: 2014-03-06T15:45:59-05:00	[thread overview]
Message-ID: <wccha7b5a48.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 87d943b8-5907-4d0f-9e80-e3c99402472c@googlegroups.com

oktawian.lagiewski@gmail.com writes:

> When i use gcc - program.adb i get two new files (ali and o). I wanted to create
> executable so i typed gnatbind program but i get message:

You don't need to use gcc and gnatbind.  You should use gnatmake or
gprbuild instead.

> "program.adb:1: Program cannot be used as a main program.

The "main" must be a library unit procedure with no parameters.
You put most of your code in packages, in files like this_package.ads,
this_package.adb, that_package.ads, that_package.adb.  Then you have
a main procedure (not a package), perhaps program.adb.  This procedure with's
one or more packages and calls things in them.

Then you say:

    gnatmake -gnata -gnato -g -O0 program.adb

and it will invoke gcc and gnatbind automatically.

The switches "-gnata -gnato -g -O0" are good for debugging builds.
You can look up what they mean, if you like.

You can put all your code in program.adb, but that doesn't scale
well.  Sooner or later you're going to want separate library
packages.

- Bob

      parent reply	other threads:[~2014-03-06 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  8:35 Can't create executable file oktawian.lagiewski
2014-03-06  8:41 ` Dmitry A. Kazakov
2014-03-06 20:45 ` Robert A Duff [this message]
replies disabled

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