[mercury-users] mmc --make and -I option

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Feb 23 14:00:34 AEDT 2006


On Thu, 23 Feb 2006, Ian MacLarty wrote:

> Hello,
>
> In the mmc help message the -I option has the following description:
>
> -I <dir>, --search-directory <dir>
>         Append <dir> to the list of directories to be searched for
>         imported modules.
>
> However if I have the following program:
>
> :- module test.
> :- interface.
> :- import_module io.
> :- pred main(io::di, io::uo) is det.
> :- implementation.
> :- import_module test2.
> main(!IO) :-
> 	test2.print(!IO),
> 	nl(!IO).
>
> which includes the following module:
>
> :- module test2.
> :- interface.
> :- import_module io.
> :- pred print(io::di, io::uo) is det.
> :- implementation.
> print(!IO) :- io.write_string("hello\n", !IO).
>
> and I put test2.m in a subdirectory of the directory test.m is in,
> named test2, and then I try and compile test.m with the following
> command:
>
> mmc --make test -I test2
>
> I get the following error:
> ** Error: error reading file `test2.m' to generate dependencies.
> ** Module `test2' is imported or included by module `test'.
> mercury_compile: can't find source for module `test2'.
>
> Why doesn't mmc find test2.m in the test2 directory?  I think it should
> because of the value of the -I option I gave.
>
> Is this a bug or do I need to compile the file in the test2 directory first?

I'm pretty sure that you need to compile it first - at least that's the
way we use '-I' in the compiler.  I take it you are trying to distribute
your source tree over several directories or something?  If you want to
do that you can just use the source file renaming facility, i.e. the
'-f' option to mmc; that works fine with 'mmc --make'.

Cheers,
Julien.







--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list