[mercury-users] Modules, Submodules and Instances.

Ralph Becket rwab1 at cam.sri.com
Sun Jan 31 04:50:25 AEDT 1999

Following on from the recent discussion, I think I may have found a
bug in the compiler.

I've been having a go at the battleships challenge.  Now, I have the
following modules:

main.m		- imports battle & rwab1, exports main.
battle.m	- defines player/1 typeclass and exports game engine.
rwab1.m		- defines various instances of player/1.
rwab1.silly.m	- implementation of silly player.
rwab1.human.m	- implementation of human player; uses rwab1.view.
rwab1.logging.m	- implementation of logging player.
rwab1.view.m	- implementation of game board ADT.

But I'm getting a very odd error message from the compiler at link

$ mmake main.depend
mmc --generate-dependencies  --use-subdirs   main
# the following mkdirs work around a bug in GNU Make
[ -d Mercury/dates ] || mkdir Mercury/dates
[ -d Mercury/date0s ] || mkdir Mercury/date0s
[ -d Mercury/date3s ] || mkdir Mercury/date3s
[ -d Mercury/optdates ] || mkdir Mercury/optdates

$ mmake main
rm -f Mercury/cs/battle.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   battle.m > battle.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/battle.c -o Mercury/os/battle.o
mmc --make-interface  --use-subdirs   battle.m
mmc --make-short-interface  --use-subdirs   battle.m
mmc --make-short-interface  --use-subdirs   rwab1.human.m
mmc --make-short-interface  --use-subdirs   rwab1.logging.m
mmc --make-short-interface  --use-subdirs   rwab1.silly.m
mmc --make-short-interface  --use-subdirs   rwab1.view.m
mmc --make-interface  --use-subdirs   rwab1.m
rm -f Mercury/cs/main.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   main.m > main.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/main.c -o Mercury/os/main.o
mmc --make-private-interface  --use-subdirs   rwab1.m
mmc --make-short-interface  --use-subdirs   rwab1.m
mmc --make-interface  --use-subdirs   rwab1.human.m
mmc --make-interface  --use-subdirs   rwab1.logging.m
mmc --make-interface  --use-subdirs   rwab1.silly.m
mmc --make-interface  --use-subdirs   rwab1.view.m
rm -f Mercury/cs/rwab1.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   rwab1.m > rwab1.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/rwab1.c -o Mercury/os/rwab1.o
rm -f Mercury/cs/rwab1.human.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   rwab1.human.m > rwab1.human.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/rwab1.human.c -o Mercury/os/rwab1.human.o
rm -f Mercury/cs/rwab1.logging.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   rwab1.logging.m > rwab1.logging.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/rwab1.logging.c -o Mercury/os/rwab1.logging.o
rm -f Mercury/cs/rwab1.silly.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   rwab1.silly.m > rwab1.silly.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/rwab1.silly.c -o Mercury/os/rwab1.silly.o
rm -f Mercury/cs/rwab1.view.c
mmc --compile-to-c --grade asm_fast.gc     --use-subdirs   rwab1.view.m > rwab1.view.err 2>&1
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/rwab1.view.c -o Mercury/os/rwab1.view.o
c2init --grade asm_fast.gc       Mercury/cs/battle.c Mercury/cs/main.c Mercury/cs/rwab1.c Mercury/cs/rwab1.human.c Mercury/cs/rwab1.logging.c Mercury/cs/rwab1.silly.c Mercury/cs/rwab1.view.c > Mercury/cs/main_init.c
mgnuc --grade asm_fast.gc     -I.       -c Mercury/cs/main_init.c -o Mercury/os/main_init.o
ml --grade asm_fast.gc       -o main Mercury/os/main_init.o \
        Mercury/os/battle.o Mercury/os/main.o Mercury/os/rwab1.o Mercury/os/rwab1.human.o Mercury/os/rwab1.logging.o Mercury/os/rwab1.silly.o Mercury/os/rwab1.view.o    
Undefined                       first referenced
 symbol                             in file
mercury_data___base_typeclass_info_batt:player_1 Mercury/os/main.o
mercury_data___base_typeclass_info_batt:player_1 Mercury/os/main.o
ld: fatal: Symbol referencing errors. No output written to main
gmake: *** [main] Error 1

Doing `mmake main' again has no effect.  HELP!  Is this me or mmc?


Ralph Becket  |  rwab1 at cam.sri.com  |  http://www.cam.sri.com/people/becket.html

More information about the users mailing list