我写了一个只包含一行代码的Ocaml文件:open Findlib
,然后我保存文件并命名为test.ml
。在Ocaml64(Ocaml for windows)环境中,我输入命令ocamlc -o test test.ml
,出现错误:Error:Unbound module Findlib
。但是如果我打开 ocaml 交互环境并这样做:
$ ocaml
OCaml version 4.12.0
# #use "topfind"
;;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
# open Findlib;;
#
它可以工作,所以我确定存在 Findlib 库,我不知道为什么在编译包含open findlib
.