我有一个 OCaml 项目,但遇到了一个奇怪的问题。
目录结构如下所示:
./tests
test.ml
templatetest.ml
./src
template.ml
...
andsoforth.ml
我正在这样构建它:
ocamlbuild -Is src,tests tests/test.native
关键是,tests/test.ml 依赖于tests/templatetest.ml。
当我构建它时,我得到:
+ /usr/local/bin/ocamlc.opt -c -I tests -I src -o tests/test.cmo tests/test.ml
File "tests/test.ml", line 1, characters 0-17:
Error: Unbound module TemplateTest
Command exited with code 2.
Compilation unsuccessful after building 2 targets (0 cached) in 00:00:00.
我尝试在顶级目录中添加一个 _tags 文件,其中包含:
<src> or <tests>: include
这仍然产生了同样的错误。(我相信带有 _tags 文件的 ocamlbuild tests/test.native 与我之前使用的构建行完全相同。)
我还在 ./tests 和 ./src 中创建了一个空的 _tags 文件,但这也没有改变任何东西。
有什么建议么?如果您需要,整个来源都在这里。跑吧make test
。谢谢!