我尝试在我的一个文件中打开Yojson.Basic.Util,并一直得到一个unbound module错误。我尝试过几种不同的方法,但似乎找不出出了什么问题
我的.ocamlinit里有这个
#require "yojson";;
#require "ANSITerminal";;这个在我的makefile里
test:
ocamlbuild -pkg yojson, oUnit test.byte && ./test.byte
play:
ocamlbuild -pkgs oUnit,yojson,str,ANSITerminal main.byte && ./main.byte
check:
bash checkenv.sh
clean:
ocamlbuild -clean键入make会产生以下错误:
ocamlbuild -pkg yojson, oUnit test.byte && ./test.byte
ocamlfind: Package `yojson,' not found
Cannot run Ocamlfind.
make: *** [test] Error 2将makefile更改为:
test:
ocamlbuild -use-ocamlfind -pkg yojson, oUnit test.byte && ./test.byte
play:
ocamlbuild -pkgs oUnit,yojson,str,ANSITerminal main.byte && ./main.byte
check:
bash checkenv.sh
clean:
ocamlbuild -clean我输入了make,它给了我这个错误:
ocamlbuild -use-ocamlfind -pkg yojson, oUnit test.byte && ./test.byte
Solver failed:
Ocamlbuild knows of no rules that apply to a target named oUnit. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.
make: *** [test] Error 6发布于 2016-12-04 01:27:58
用于ocamlbuild的-pkg和-pkgs选项之间存在差异。-pkg选项只有一个包名。-pkgs选项接受逗号分隔的包名列表(逗号前后可以有可选空格,但是必须引用参数)。
在您的示例中,您使用-pkg,但是带有逗号分隔的参数列表,并且该列表有一个空格,因此必须引用它。使用-pkgs yojson,oUnit应该可以解决这个问题。
https://stackoverflow.com/questions/40954066
复制相似问题