I'm trying to document a small project of mine using ocamldoc.
I have one main .ml
file which opens
two others .ml
files.
$ ocamldoc -html included1.ml included2.ml
Works just fine, but when I add the including file, like
$ ocamldoc -html included1.ml included2.ml including.ml
I get this:
File "including.ml", line 5, characters 5-16:
Error: Unbound module Included1
1 error(s) encountered
I see from the ocamldoc documentation that opening modules is perfectly fine, until no conflict arises.
How should I proceed?
It's fine for a module to use other modules however it needs to be able to see the compiled interfaces for those. So in your case you first need to compile the .ml
files to generate .cmi
files. Then you need to indicate to ocamldoc where these files are. So something like this should do:
ocamlc -c included1.ml
ocamlc -c included2.ml
ocamlc -c -I . including.ml
ocamldoc -html -I . included1.ml included2.ml including.ml
Note that in general it's a good (essential) practice to create .mli
files for each of your modules an document and ocamldoc
these rather than the .ml
files.