I wrote a Ocaml file which only contains one line code: open Findlib
,and then I save the file and named it for test.ml
.In the Ocaml64(Ocaml for windows) environment ,I typed command ocamlc -o test test.ml
,there is an error: Error:Unbound module Findlib
.
But if I open the ocaml interactive enviroment and do it like this:
$ 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;;
#
it works,so I'am sure the Findlib library exists,I don't know why the error will happen when I compiling the file contains open findlib
.