本文介绍了Ocaml utop库路径,核心模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用utop中的Core模块,该模块由Jane Street发起并使用opam安装.

I am attempting to use the Core module in utop, as originated by Jane Street and installed using opam.

问题出在这里

utop # open Core.Std;;
Error: Unbound module Core

utop似乎没有指向Core模块的路径.

utop does not seem to have the path to the Core module.

如何指定utop可以找到的路径以访问Core模块?是否有一个utop初始化文件指定了库路径?

How do you specify a path that can be found by utop to access the Core module? Is there a utop init file that specifies library paths ?

我从OCaml 4.01.0解释器收到了相同的错误消息.

I have the same error message from the OCaml 4.01.0 interpreter.

我唯一可以避免此错误的方法是将目录更改为/Users/myname/.opam/system/lib/core.

The only way I can avoid this error is actually changing directory to /Users/myname/.opam/system/lib/core.

推荐答案

我遇到了同样的问题,这里的说明对我有用.

I had the same problem, the directions here got it working for me.

https://github.com/realworldocaml/book/wiki /Installation-Instructions#setting-up-and-using-utop

将以下行添加到〜/.ocamlinit文件中

add the following lines to your ~/.ocamlinit file

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

这篇关于Ocaml utop库路径,核心模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 11:08