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.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Undefined reference errors and strange new files appearing Date: Sat, 21 Jun 2014 19:21:52 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net E59c7EyhAvWGoOE2+18e/wVy/b8VXkF8zE3hhue7j2mt188oeX Cancel-Lock: sha1:8P7YfiCRX6zQENtqHqSxiPvtK4Y= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 Xref: news.eternal-september.org comp.lang.ada:20498 Date: 2014-06-21T19:21:52-03:00 List-Id: Hi, Still struggling to get a foot into Ada. I wrote a simple abstract linear list library, "gen-lists", and a test programs test_genlists which uses it. The files are: gen-lists.ads abstract linear list gen-lists.adb test_lists_aux.ads concrete extension of the list test_lists_aux.adb test_lists.adb main subprogram The project file gen.gpr for the library is --------------------------------------------------------------------- library project Gen is for Library_Name use "Gen"; for Library_Dir use "../All"; for Source_Dirs use ("src"); for Object_Dir use "obj"; package Compiler is for Default_Switches ("ada") use ("-gnatf", "-gnato", "-gnat05", "-g"); end Compiler; end Gen; --------------------------------------------------------------------- and test_genlists.gpr for the test program: --------------------------------------------------------------------- with "../../gen.gpr"; project Test_Genlists is for Main use ("test_lists.adb"); package Compiler is for Default_Switches ("ada") use ("-g", "-gnatf", "-gnat05"); end Compiler; package Linker is for Default_Switches ("ada") use ("-g"); end Linker; end Test_Genlists; --------------------------------------------------------------------- Now "gnatmake -Ptest_genlists" gets me --------------------------------------------------------------------- gcc-4.6 -c -g -gnatf -gnat05 -I- -gnatA /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists.adb gcc-4.6 -c -gnatf -gnato -gnat05 -g -I- -gnatA /home/frank/Lib/Ada/Gen/src/gen.ads gcc-4.6 -c -gnatf -gnato -gnat05 -g -I- -gnatA /home/frank/Lib/Ada/Gen/src/gen-lists.adb gcc-4.6 -c -g -gnatf -gnat05 -I- -gnatA /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists_aux.adb building static library for project gen ar cr /home/frank/Lib/Ada/All/libGen.a /home/frank/Lib/Ada/Gen/obj/gen-lists.o ... ranlib /home/frank/Lib/Ada/All/libGen.a gnatbind -I- -x /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists.ali gnatlink /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists.ali -g -L/home/frank/Lib/Ada/All/ -lGen -o /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists b~test_lists.o: In function `adainit': /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/b~test_lists.adb:158: undefined reference to `gen__lists___elabs' /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/b~test_lists.adb:159: undefined reference to `gen__lists_E' /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists_aux.o: In function `test_lists_aux__itemdIP': test_lists_aux.adb:(.text+0x2b): undefined reference to `gen__lists__itemdIP' /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists_aux.o: In function `test_lists_aux__itemdSR': test_lists_aux.adb:(.text+0x65): undefined reference to `gen__lists__itemdSR' /home/frank/Lib/Ada/Gen/tests/Test_gen-lists/test_lists_aux.o: In function `test_lists_aux__itemdSW': test_lists_aux.adb:(.text+0x99): undefined reference to `gen__lists__itemdSW' ... -------------------------------------------------------------------- The 3 dots mean a bunch of further error messages. Besides this, the new files b~test_lists.adb b~test_lists.ads b~test_lists.ali b~test_lists.o appear out of nowhere. I guess I forgot something in the project files. Nevertheless I reproduce the start of my sources: gen-lists.ads: ------------------------------------------------------------------- -- Abstract linear lists package Gen.Lists is -- the list and its primitive operations type ItemD is abstract tagged private; type Item is access all ItemD'Class; type List is limited private; function IsEmpty (l: List) return boolean; function Next (i: access ItemD) return Item; procedure Append (l: in out List; i: Item); ... ------------------------------------------------------------------- gen-lists.adb: ------------------------------------------------------------------- --Abstract linear lists package body Gen.Lists is -- primitive list operations function IsEmpty (l:List) return Boolean is begin return l.first=null; end IsEmpty; function Next (i:access ItemD) return Item is begin return i.next; end Next; procedure Append (l: in out List; i:Item) is begin if l.first=null then l.first:= i; else l.last.next:= i; end if; l.last:= i; end Append; ... -------------------------------------------------------------------- test_lists_aux.ads: -------------------------------------------------------------------- -- Test of Gen.Lists with Gen.Lists; package test_lists_aux is type ItemD is new Gen.Lists.ItemD with record ch: Character; end record; type Item is access all ItemD; function NewItem (c: Character) return Item; ... ------------------------------------------------------------------- test_lists_aux.adb: ------------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; package body test_lists_aux is function NewItem (c: Character) return Item is i: Item; begin i:= new ItemD; i.ch := c; return i; end NewItem; ... ------------------------------------------------------------------- test_lists.adb: ------------------------------------------------------------------- -- Test of Gen.Lists with Ada.Text_IO; use Ada.Text_IO; with Gen.Lists; with test_lists_aux; procedure Test_Lists is a, b, c, d, e: test_lists_aux.Item; list: Gen.Lists.List; begin -- print header Put_Line(""); Put_Line ("Test of Gen.Lists"); Put_Line ("-----------------"); -- create list a:= test_lists_aux.NewItem ('a'); b:= test_lists_aux.NewItem ('b'); c:= test_lists_aux.NewItem ('c'); d:= test_lists_aux.NewItem ('d'); e:= test_lists_aux.NewItem ('e'); Gen.Lists.Append (list, Gen.Lists.Item(a)); Gen.Lists.Append (list, Gen.Lists.Item(b)); ... ----------------------------------------------------------------- What am I doing wrong? -- Frank Hrebabetzky +55 / 48 / 3235 1106 Florianopolis, Brazil