如何在 OCaml 中使用 Benchmark link

How to link with Benchmark in OCaml

我创建了一个简单的文件

benchmark.ml:

open Benchmark ;;

print_string "It works!"; print_newline() ;;

然后我尝试使用 Makefile 的以下内容构建它

# put here the names of your source files (in the right order)
SOURCES = benchmark.ml

# the name of the resulting executable
RESULT  = benchmark

# generate type information (.annot files)
ANNOTATE = yes

# make target (see manual) : byte-code, debug-code, native-code, ...
all: debug-code

include OCamlMakefile

但我收到错误消息:

Unbound module Benchmark

我应该怎么做才能解决它?我尝试使用 INCDIRSPACKS 但无济于事。

PACKS 是正确的解决方案。

只是不要将您的文件命名为 benchmark.ml,如果您打算使用另一个模块,该模块已经被称为 Benchmark