[英]Unbound module core while trying to compile ocaml file
我在尝试使用ocamlc -o hello hello.ml
编译ocaml文件时ocamlc -o hello hello.ml
它给了我这个错误
错误:未绑定的模块核心
这很奇怪,因为当我使用utop并使用open Core.Std;;
导入core std open Core.Std;;
它确实可以工作并导入,如何解决此问题的任何想法?
提前致谢
open Core.Std
并没有真正导入core
,只是将其值放在作用域中,以便您可以将Core.Std.x
称为x
。
要导入它,您需要传递它以在编译器中以某种方式require
该软件包。 最简单的方法是使用ocamlfind
:
ocamlfind ocamlc -package core -linkpkg -o hello hello.ml
在utop
执行此操作的相应方法是在命令行上传递-require core
或在REPL中传递#require "core"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.