[m-users.] undefined predicate during link!
Sean Charles (emacstheviking)
objitsu at gmail.com
Mon Apr 26 01:51:32 AEST 2021
I split my now working code into two modules, and I am as sure as I can be that I did everything correctly but obv. not!
The mmcdoc project has been my benchmark so far and as far as I can see apart from the names, I have the same makefile, and followed the pattern, but I am getting a link error:
➜ f2 make
mmc -s hlc.gc -O4 -E --make felt
Making Mercury/int3s/options.int3
Making Mercury/ints/options.int
Making Mercury/cs/felt.c
felt.m:037: In clause for predicate `main'/2:
felt.m:037: error: undefined predicate `do_command_line'/4.
** Error making `Mercury/cs/felt.c'.
make: *** [felt] Error 1
Here are the relevant parts of the files:
felt.m
:- module felt.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list, maybe, string.
:- use_module options.
main(!IO) :-
do_command_line(Flags, Files, !IO),
(
Flags = no
;
Flags = yes(_Options),
foldl(io.print_line, Files, !IO)
).
options.m
:- module options.
:- interface.
:- import_module io.
:- import_module bool, char, getopt_io, list, map, maybe, string.
:- pred do_command_line(
maybe(option_table(felt_option))::out,
list(string)::out,
io::di, io::uo) is det.
% some exported types then...
:- implementation.
:- import_module list, string.
do_command_line(Options, SourceFiles, !IO) :-
And I guess here’s the makefile just to be sure…. sorry…. :|
Help!!!
BIN=felt
DEPS=felt.m options.m
FILES=$(patsubst %.m,%,$(DEPS))
GENEXT=d,o,mh,err,c,c_date,mh,mih
GRADE=hlc.gc
# this one links to the extras folder in case you need it.
# FLAGS=--ml posix --mld /usr/local/mercury-rotd-2021-04-15/extras/lib/mercury -s $(GRADE) -O4
FLAGS=-s $(GRADE) -O4 -E
all:: $(BIN)
install:: $(BIN)
mv -f -v $(BIN) $(HOME)/bin/
%: %.m $(DEPS)
mmc $(FLAGS) --make $@
$(BIN): $(DEPS)
mmc $(FLAGS) --make $(BIN)
mv -fv $(BIN) $(BIN)
clean::
rm -rf Mercury
rm -fv $$(for x in $(FILES); do echo $$x.{$(GENEXT)}; done)
rm -fv $(BIN)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210425/e38b6fe6/attachment.html>
More information about the users
mailing list