[m-users.] undefined predicate during link!

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Apr 26 01:58:37 AEST 2021



On Sun, 25 Apr 2021 16:51:32 +0100, "Sean Charles (emacstheviking)" <objitsu at gmail.com> wrote:
> 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)
>     ).

That is not an undefined predicate during link, that is an
undefined predicate during compilation.

The problem is that

(a) the call to do_command_line is not module qualified,
i.e. it does not say what module defines this predicate, but

(b) the line ":- use_module options" tells the compiler
that all references to the things imported from the options module
*will* be module qualified.

So the compiler is telling you it does not know what module
defines do_command_line, since it "knows" from the use_module
that it cannot be options.m.

I will look into improving the error message in such cases.

Zoltan.


More information about the users mailing list