2016-12-04 4 views
1

私は自分のファイルの一つにYojson.Basic.Utilを開こうとしましたが、引き続きu nbound moduleエラーが発生します。私makefileにこのアンバウンドモジュールYojson.Basic.Util

#require "yojson";; 
#require "ANSITerminal";; 

と::私は、いくつかの異なるものを試してみたと

私は.ocamlinitでこれを持って間違っているかを把握することができないよう

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ため-pkg-pkgsオプションの違いがあり

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 

答えて

2

-pkgオプションには、1つのパッケージ名しか使用されません。 -pkgsオプションはカンマで区切られたパッケージ名のリストを取ります(コンマの前後にはオプションのスペースがありますが、引数を引用する必要があります)。

例では、-pkgを使用しますが、コンマ区切りの引数リストを使用しています。このリストにはスペースがあるため、引用符で囲む必要があります。 -pkgs yojson,oUnitを使用すると問題が解決するはずです。