From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Can't create executable file. Date: Thu, 06 Mar 2014 15:45:59 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <87d943b8-5907-4d0f-9e80-e3c99402472c@googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1394138765 9682 192.74.137.71 (6 Mar 2014 20:46:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 6 Mar 2014 20:46:05 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:+ImwUMpYPcXqUwbdfbBjSkEPDK0= X-Received-Bytes: 1920 X-Received-Body-CRC: 1054176717 Xref: news.eternal-september.org comp.lang.ada:18793 Date: 2014-03-06T15:45:59-05:00 List-Id: 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