首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无界模块Yojson.Basic.Util

无界模块Yojson.Basic.Util
EN

Stack Overflow用户
提问于 2016-12-04 00:25:43
回答 1查看 864关注 0票数 1

我尝试在我的一个文件中打开Yojson.Basic.Util,并一直得到一个unbound module错误。我尝试过几种不同的方法,但似乎找不出出了什么问题

我的.ocamlinit里有这个

代码语言:javascript
复制
#require "yojson";;
#require "ANSITerminal";;

这个在我的makefile

代码语言:javascript
复制
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会产生以下错误:

代码语言:javascript
复制
ocamlbuild -pkg yojson, oUnit test.byte && ./test.byte
ocamlfind: Package `yojson,' not found
Cannot run Ocamlfind.
make: *** [test] Error 2

makefile更改为:

代码语言:javascript
复制
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,它给了我这个错误:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-04 01:27:58

用于ocamlbuild的-pkg-pkgs选项之间存在差异。-pkg选项只有一个包名。-pkgs选项接受逗号分隔的包名列表(逗号前后可以有可选空格,但是必须引用参数)。

在您的示例中,您使用-pkg,但是带有逗号分隔的参数列表,并且该列表有一个空格,因此必须引用它。使用-pkgs yojson,oUnit应该可以解决这个问题。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40954066

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档