简体   繁体   中英

Unbound module core while trying to compile ocaml file

i'm having a problem while trying to compile an ocaml file with ocamlc -o hello hello.ml it gives me this error

Error: Unbound module Core

which is weird because when i use utop and import the core std with open Core.Std;; it does work and import it, any ideas of how to solve this problem ?

Thanks in advance

open Core.Std does not really import core , it just puts its values in scope so that you can refer to Core.Std.x as just x .

To import it you need to pass it to require the package somehow in your compiler. The easiest way is to use ocamlfind :

ocamlfind ocamlc -package core -linkpkg -o hello hello.ml

The corresponding way to do that in utop is by passing -require core on the command line or #require "core" in the REPL.

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