Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unbound module core while trying to compile ocaml file

Tags:

ocaml

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

like image 496
genos Avatar asked Mar 11 '23 01:03

genos


1 Answers

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.

like image 172
Étienne Millon Avatar answered Mar 12 '23 16:03

Étienne Millon