简体   繁体   English

OCaml:具有〜/ .ocamlinit设置的未绑定模块核心

[英]OCaml: Unbound module Core with ~/.ocamlinit setup

I have installed a few packages using opam, such as Core and Batteries. 我已经使用opam安装了一些软件包,例如Core和Batteries。 The ocamlinit file is as follows: ocamlinit文件如下:

(* Added by OPAM. *)

#use "topfind"
#thread
#camlp4o
#require "core.top"
#require "core.syntax"
#require "batteries"

let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()
;;

When I run this with utop I can see the modules for Batteries but I cannot see any of the modules for Core. 当我用utop运行此程序时,我可以看到电池模块,但是看不到任何Core模块。 When I try to do open Core or open Core.Std I get an unbound module error. 当我尝试open Coreopen Core.Std出现未绑定的模块错误。 I also tried adding in #require "core" and the error persisted. 我还尝试添加#require "core" ,错误仍然存​​在。

I'm not sure what the error is since I followed the installation instructions from the book "Real World OCaml". 我不确定是什么错误,因为我按照《 Real World OCaml》一书中的安装说明进行操作。

I also see two messages when I start off utop: 从utop开始时,我还会看到两条消息:

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

I'm not sure if these are related to the problem but when I do opam list ounit and opam list pipebang it shows them as installed. 我不确定这些是否与问题有关,但是当我执行opam list ounitopam list pipebang它们显示为已安装。

Ok, I made a fresh install of OCaml and I found out that the problem is indeed related to 好的,我重新安装了OCaml,发现问题确实与

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

What happened was when I tried to opam install yojson async an error occurred. 发生了什么事,当我尝试opam install yojson async发生了错误。 From that point onward Core didn't load properly. 从那时起,Core无法正确加载。

So I suppose something is wrong with the installation instructions on 'Real World OCaml' for the additional libraries. 因此,我想其他库在“ Real World OCaml”上的安装说明有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM