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!news.bbs-scene.org!border4.nntp.dca.giganews.com!backlog4.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!s09-04.readnews.com!not-for-mail X-Trace: DXC==;1o963aDDaP9gA:]752Jd[3OhcoN[H0`X44`8^\]>7j25[I[UfBM:e>K`gGFg:INiI_NWCh3<@og;bH^b Newsgroups: comp.lang.ada Subject: Re: gnatmake error I don't understand Message-ID: <20140404061439.30bcff62@lufsen.sandat.dyndns.org> References: X-Newsreader: Claws Mail 3.9.0 (GTK+ 2.24.8; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit NNTP-Posting-Host: cbdb4258.ngroups.net X-Original-Bytes: 5188 Xref: news.eternal-september.org comp.lang.ada:19114 Date: 2014-04-04T06:14:39+02:00 List-Id: On Thu, 03 Apr 2014 20:35:18 -0400 agent@drrob1.com wrote: The attribute "Main" is a file-name so it shall be: for main use ("habits.adb"); and not: for main use ("Habits"); /Per > I typed the following code from a recent issue of Linux Format > > texthabits.ads > with Ada.Text_IO, Ada.Strings.Unbounded, > Ada.Strings.Unbounded.Text_IO, Ada.Integer_Text_IO; > use Ada.Text_IO, Ada.Strings.Unbounded, > Ada.Strings.Unbounded.Text_IO, Ada.Integer_Text_IO; > > -- REVISION HISTORY > -- ================ > -- 31 Mar 14 -- Extracted from LinuxFormat LXF 181 coding article > > Package texthabits is > > PROCEDURE CreateOrOpen (File: in out File_Type; Name: in String; Form: > in String := ""); > > Procedure OpenOrCreateDataFile(File : in out File_Type; Name : in > String); > > Procedure ReadAndDisplayDatafile(File : in out File_Type; Name : > String); > > Procedure Habits ; > > END texthabits; > > ----------------------------------------------------------------------------------------- > texthabits.adb > with Ada.Text_IO, Ada.Strings.Unbounded, > Ada.Strings.Unbounded.Text_IO, Ada.Integer_Text_IO, Ada.Calendar, > Ada.Directories; > use Ada.Text_IO, Ada.Strings.Unbounded, > Ada.Strings.Unbounded.Text_IO, Ada.Integer_Text_IO, Ada.Calendar, > Ada.Directories; > > -- REVISION HISTORY > -- ================ > -- 31 Mar 14 -- Extracted from LinuxFormat LXF 181 coding article > > > Package body texthabits is > habit : Unbounded_String; > filehandle : File_Type; > HabitFileName : String(1..13); > ctr : Natural := 1; > > PROCEDURE CreateOrOpen (File: in out File_Type; Name: in String; Form: > in String := "") is > BEGIN > Open(File, Append_File, Name, Form); > EXCEPTION > WHEN Ada.Text_IO.Name_Error => > Create(File, Out_File, Name, Form); -- If must create file, then > append_file does not make sense, even if desired. > END CreateOrOpen; > > Procedure OpenOrCreateDataFile(File : in out File_Type; Name : in > String) is > Begin > Open(File, Append_File, Name); > Exception > when Ada.Text_IO.Name_Error => Create(File => File, Mode => > Append_File, Name => Name); > End OpenOrCreateDataFile; > > Procedure ReadAndDisplayDatafile(File : in out File_Type; Name : > String) is > buffer : String(1..100); > length : Natural; > Begin > IF EXISTS(Name) THEN > Open(File => File, Mode => In_File, Name => Name); > While not End_Of_File(File => File) loop > Get_Line(File => File, item => buffer, last => Length); > Put_Line(buffer(1..length)); > end loop; > Close(File); > END IF; -- if exists > End ReadAndDisplayDatafile; > > > Procedure Habits is > Begin > HabitFileName := "habitfile.txt"; > ReadAndDisplayDatafile(filehandle, HabitFileName); -- for input. Do > nothing if file does not exist. > OpenOrCreateDataFile(filehandle, HabitFileName); -- for output > LOOP > Put(" Enter a new habit, quit or exit: "); > habit := Get_Line; > exit when (CAP(To_STRING(Head(Habit,4))) = "QUIT") OR > (CAP(to_string(Head(Habit,4))) = "EXIT") ; > Put_Line(filehandle,Habit); > ctr := ctr + 1; > END LOOP; > Close(filehandle); > Put(" You entered and saved "); > Put(ctr,3); > Put_Line(" new habits."); > End Habits; > > END texthabits; > --------------------------------------------------------------------------------- > texthabits.gpr > project texthabits is > for Source_Files use ("texthabits.adb", "texthabits.ads", > "tokenizea.ads", "tokenizea.adb"); > for Source_Dirs use (".", "./**"); > for Main use ("Habits"); > > package Builder is > for Default_Switches ("Ada") > use ("-g"); > end Builder; > > package Compiler is > for Default_Switches ("Ada") > use ("-fstack-check", > "-gnatVa", > "-g", > "-gnato", > "-gnatf", > "-gnatwu", > "-gnat2012"); > end Compiler; > > end texthabits; > > ------------------------------------------------------------------------------ > Ubuntu 12.04 amd64 version > > gnatmake -Ptexthabits > > gnatmake: "Habits" is not a source of project texthabits. > > I don't understand the error or what to do about it. > > Thanks, > Rob Solomon >