4
votes

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

1

1 Answers

7
votes

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.