尝试编译ocaml文件时解除绑定模块核心

尝试编译ocaml文件时解除绑定模块核心,ocaml,Ocaml,当我试图用ocamlc-o hello hello.ml编译ocaml文件时遇到问题,它给了我这个错误 错误:未绑定模块核心 这很奇怪,因为当我使用utop并使用opencore.std;导入core std时它可以工作并导入,有没有解决这个问题的方法 提前感谢opencore.Std并没有真正导入Core,它只是将其值放入范围内,以便您可以将Core.Std.x作为x引用 要导入它,您需要将它传递给编译器中的包require。最简单的方法是使用ocamlfind: ocamlfind ocam

当我试图用
ocamlc-o hello hello.ml编译ocaml文件时遇到问题,它给了我这个错误

错误:未绑定模块核心

这很奇怪,因为当我使用utop并使用
opencore.std;导入core std时它可以工作并导入,有没有解决这个问题的方法


提前感谢

opencore.Std
并没有真正导入
Core
,它只是将其值放入范围内,以便您可以将
Core.Std.x
作为
x
引用

要导入它,您需要将它传递给编译器中的包
require
。最简单的方法是使用
ocamlfind

ocamlfind ocamlc -package core -linkpkg -o hello hello.ml
utop
中,相应的方法是在命令行上传递
-require core
,或在REPL中传递
#require“core”