问题描述
我已经使用opam安装了一些软件包,例如Core和Batteries. ocamlinit文件如下:
I have installed a few packages using opam, such as Core and Batteries. The ocamlinit file is as follows:
(* 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 -> ()
;;
当我用utop运行此程序时,我可以看到电池模块,但看不到任何Core模块.当我尝试执行open Core
或open Core.Std
时,出现未绑定的模块错误.我还尝试添加#require "core"
,错误仍然存在.
When I run this with utop I can see the modules for Batteries but I cannot see any of the modules for Core. When I try to do open Core
or open Core.Std
I get an unbound module error. I also tried adding in #require "core"
and the error persisted.
由于我遵循《 Real World OCaml》一书中的安装说明,因此不确定错误是什么.
I'm not sure what the error is since I followed the installation instructions from the book "Real World OCaml".
从utop开始时,我还会看到两条消息:
I also see two messages when I start off utop:
No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"
我不确定这些是否与问题有关,但是当我执行opam list ounit
和opam list pipebang
时,它们会显示为已安装.
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.
推荐答案
好,我重新安装了OCaml,发现问题确实与
Ok, I made a fresh install of OCaml and I found out that the problem is indeed related to
No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"
发生的事情是当我尝试opam install yojson async
时发生了错误.从那时起,Core无法正确加载.
What happened was when I tried to opam install yojson async
an error occurred. From that point onward Core didn't load properly.
所以我想其他库在"Real World OCaml"上的安装说明有问题.
So I suppose something is wrong with the installation instructions on 'Real World OCaml' for the additional libraries.
这篇关于OCaml:具有〜/.ocamlinit设置的未绑定模块核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!