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: border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!easynews!core-easynews-01!easynews.com!en-nntp-16.dc1.easynews.com.POSTED!not-for-mail From: agent@drrob1.com Newsgroups: comp.lang.ada Subject: gnatmake error I don't understand Message-ID: User-Agent: ForteAgent/7.20.32.1218 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@easynews.com Organization: Forte Inc. http://www.forteinc.com/apn/ X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Thu, 03 Apr 2014 20:35:18 -0400 X-Received-Bytes: 4640 Xref: number.nntp.dca.giganews.com comp.lang.ada:185491 Date: 2014-04-03T20:35:18-04:00 List-Id: 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