我正在尝试使用ocamldoc记录我的一个小项目
我有一个主.ml
个文件opens
另外两个.ml
个文件。
$ ocamldoc -html included1.ml included2.ml
工作得很好,但是当我添加包含文件时,比如
$ ocamldoc -html included1.ml included2.ml including.ml
我明白了:
File "including.ml", line 5, characters 5-16:
Error: Unbound module Included1
1 error(s) encountered
我从ocamldoc documentation看到开放模块完全正常,直到没有冲突出现 我该怎么办?
答案 0 :(得分:2)
模块可以使用其他模块,但是它需要能够看到编译后的接口。因此,在您的情况下,首先需要编译.ml
文件以生成.cmi
个文件。然后你需要向ocamldoc指出这些文件的位置。所以这样的事情应该做:
ocamlc -c included1.ml
ocamlc -c included2.ml
ocamlc -c -I . including.ml
ocamldoc -html -I . included1.ml included2.ml including.ml
请注意,一般来说,为每个模块创建.mli
文件和ocamldoc
这些文件而不是.ml
文件是一种很好的(基本)做法。