Reputation: 1832
I have import for Yojson in my code
open Yojson.Basic.Util
and following in Make file
eval `opam config env` && ocamlbuild -use-ocamlfind voigt.native
I'm getting error "Unbound module Yojson"
, while compiling
eval `opam config env` && ocamlbuild -use-ocamlfind voigt.native
ocamlfind ocamlopt -c -o config.cmx config.ml
+ ocamlfind ocamlopt -c -o config.cmx config.ml
File "config.ml", line 1, characters 5-22:
Error: Unbound module Yojson
Command exited with code 2.
When I use utop everything works. What should I do to correct this error?
Upvotes: 3
Views: 726
Reputation: 35260
You need to specify, that you want to use yojson
. Assuming, that the package name is yojson
the correct command would be:
ocamlbuild -use-ocamlfind -pkg yojson voigt.native
And on modern installations you even do not require to use -use-ocamlfind
flag, as it should work even without this.
Upvotes: 2