0

按照https://dune.readthedocs.io/en/stable/quick-start.html上的教程,我创建了一个hello_world.ml包含

print_endline "Hello, world!"

和一个dune包含

(executable
 (name hello_world))

然后输入

dune build hello_world.exe

但它抱怨其他(完全不相关的)文件中的错误。

dune即使文件中没有提到其他文件(甚至递归地),沙丘是否有可能查看其他文件?以及如何预防?

4

1 回答 1

2

是的,dune 将搜索当前文件夹中包含 *.ml 或 *.re 文件的所有文件。要禁用此行为,请使用该modules节并明确指定哪些模块包含您的可执行文件。例如,如果它是由hello_world.mlutilities.ml编译单元组成的,那么以下规范将为您工作,

(executable 
  (name hello_world)
  (modules hello_world utilities))
于 2022-01-19T17:27:10.980 回答