简体   繁体   中英

Telling ocamlbuild to use Core

In my project I have a file that uses Core.Std stuff, so I have run

opam install core

and added

open Core.Std

in my file.

When I run

ocamlbuild myprogram.native

it says:

Error: Unbound module Core

pointing to line with the open statement above.

So, I try this:

ocamlbuild -use-ocamlfind -pkgs core.std myprogram.native

and get the following message:

ocamlfind: Package `core.std' not found

So I thought that maybe I needed to run opam install core.std as well, but apparently there is no such thing according to opam. I also tried "open Core.Std;;" in the ocaml repl, but that did not work either. Any ideas?

You can either use corebuild which is usually shipped with this library or, you can try this:

 ocamlbuild -use-ocamlfind -pkg core

PS use ocamlfind list command to view the list of available packages.

PPS In addition to corebuild they usually ship coretop , a script that allows you to run core-enabled top-level. It uses utop underneath the hood, so make sure that you have installed it with opam install utop (if you're using opam ), before your experiments.

从ocamlbuild cmd中删除.std

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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