Re: [m-users.] [Beginner] Using a functions from 'libs'

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Am Sonntag, dem 16.10.2022 um 16:31 +0530 schrieb Razetime:
> My bad. What is the problem here? Is it a problem with
> https://github.com/Mercury-Language/mercury/blob/master/compiler/md5.m
> ?
> 
> Making Mercury/int3s/a05.int3
> Making Mercury/ints/a05.int
> Making Mercury/cs/a05.c
> Making Mercury/cs/md5.c
> Making Mercury/os/a05.o
> Making Mercury/os/md5.o
> Making a05
> Making md5
> ** Error making `md5'.
> Mercury/os/md5_init.o:md5_init.c:function mercury_init: error:
> undefined reference to '<predicate 'main'/2 mode 0>'
> collect2: error: ld returned 1 exit status

The message says that you don't have a main/2 predicate. Have you started
the compiler with --make and the module containing main/2? Then it should
trace the necessary modules automatically.

Volker

> 
> On 10/16/22, Volker Wysk <[email protected]> wrote:
> > You've mixed up the input and output arguments in the declaration of
> > main/2.
> > 
> > Volker
> > 
> > 
> > Am Sonntag, dem 16.10.2022 um 16:06 +0530 schrieb Razetime:
> > > For this program I tried using mmc --make and i got the following error.
> > > 
> > > :- module a05.
> > > 
> > > :- interface.
> > > :- import_module io.
> > > :- pred main(io::uo,io::di) is det.
> > > 
> > > :- implementation.
> > > :- import_module list.
> > > :- import_module md5.
> > > 
> > > main(!IO):-
> > >   S0=md5sum("abc3231929"),
> > >   print_line(S0,!IO)
> > >   .
> > > 
> > > 
> > > $ mmc --make a05 md5
> > > Making Mercury/int3s/a05.int3
> > > Making Mercury/ints/a05.int
> > > Making Mercury/cs/a05.c
> > > a05.m:013: In clause for `main(uo, di)':
> > > a05.m:013:   in argument 2 of call to predicate `io.print_line'/3:
> > > a05.m:013:   unique-mode error: the called procedure would clobber its
> > > a05.m:013:   argument, but variable `STATE_VARIABLE_IO_0' is still live.
> > > ** Error making `Mercury/cs/a05.c'.
> > > 
> > > How do i make sure the variable is not live?
> > > 
> > > On 10/16/22, Razetime <[email protected]> wrote:
> > > > Oh, makes sense. The md5.m file is not part of the distribution so i
> > > > have to compile it along with my program. Thanks.
> > > > 
> > > > On 10/16/22, Julien Fischer <[email protected]> wrote:
> > > > > 
> > > > > 
> > > > > On Sun, 16 Oct 2022, Razetime wrote:
> > > > > 
> > > > > > using the name md5 like follows:
> > > > > > :- module a05.
> > > > > > 
> > > > > > :- interface.
> > > > > > :- import_module io.
> > > > > > :- pred main(io::uo,io::di) is det.
> > > > > > 
> > > > > > :- implementation.
> > > > > > :- import_module list.
> > > > > > :- import_module md5.
> > > > > > 
> > > > > > main(!IO):-
> > > > > >  S0=md5sum("abc3231929"),
> > > > > >  print_line(S0,!IO)
> > > > > >  .
> > > > > > 
> > > > > > gives me this error:
> > > > > > $ mmcb a05.m
> > > > > > ~
> > > > > >                                                 │mercury_compile:
> > > > > > cannot find `Mercury/ints/md5.int' in directories .,
> > > > > > ~
> > > > > >                                                 │
> > > > > > /usr/lib/mercury/ints
> > > > > 
> > > > > Using mmc directly like that is only for building single module
> > > > > programs.  To build a program consisting of multiple modules, use
> > > > > the --make option, e.g.
> > > > > 
> > > > >      $ mmc --make a05
> > > > > 
> > > > > (See the "Using the Mercury compile" section of the Mercury users's
> > > > > guide for details.)
> > > > > 
> > > > > Julien.
> > > > 
> > > _______________________________________________
> > > users mailing list
> > > [email protected]
> > > https://lists.mercurylang.org/listinfo/users
> > 
> >

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmNL7wMACgkQ+K4ydFOs
HoX9/Q/9EWPQGPT4voxtBpkx5nE2DWuXum2ogu2zD5iwfUIZV7yWiUPZdwXDVWDT
GnThyhxAdr8mXTczHcqpr3mpb2EXO5ouc3njtcm/be3l+I7iQQdiFuiT2lvEDGOB
Mwz7i7RVkhlO93OB9jOgT2lBzESNFKe/wIDwec7p5/X8ajXhdCwy69g9KTBs1oTG
jez+Q3gfVoAtN0PbtqtzJurrRfEDNOlhseA+GTaLb46qzumKrHSeXU2lCNzS5thN
mA6KQrBJhEZrL92y8otlt/wQvT2wZ5r+tO9Cowqq18ror0FfSRTS0SmEJ5kfdeYW
9dU6l32XVcHgRN5PTEwkZC8aX4iEEtnz4DDQz8qDBDXpj8YfI1NJ9TmVIm0ZIeB+
apxNw/X/cJZBYLrADCEDwMb9IgS6/vUvAF4aEfTJ7iVeqWyEqUwRhnL/cks9id8I
8uQxDWaYjj8fGAHJf3YcNcKmF8ZWINqaaw+Zc4nb3X/v+zaBQWrq9ONIeVvVb7kX
RMcENFeIYBFV6dHdyvH82TWzCwUXY7KLHna8EzwT16++/cxP6BketvIZVD78upxQ
yGIW5uyVHeCfSrhKN0kyyINku0UEY5Kx8Uc/2AYsq6mLBT7luVjyqlADK40MeMLU
qn/nLakIChYDHPCBsUuURVH+ZYzeskycJh5pfHtZu3WWqfW/xYM=
=/hRO
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.