简体   繁体   中英

OCaml: unbound value load when trying to load module

I'm trying to load OCaml's default graphics module, but OCaml can't seem to load it or any other module. Here's what I'm trying:

> ocaml
    OCaml version 4.02.1

# load "graphics.cma";;
Error: Unbound value load

The problem persists no matter what module I try to load, so I believe that the problem is with the ocaml installation rather than with the module. I've tried reinstalling OCaml, but that hasn't helped either. I'm using OS X, and using homebrew to install ocaml. I found this link , and followed its instructions, but modules still won't load. Does anyone know what could be causing this problem?

You need to type #load , not just load .

Note that the OCaml prompt is also # . So it's confusing.

$ ocaml
        OCaml version 4.02.1

# load "unix.cma";;
Error: Unbound value load
# #load "unix.cma";;
# 

Current state of the art if I dare say is

  • using opam to install packages,
  • findlib for using them in the toplevel,
  • and ocamlfind for the compilation.

If your project is bigger you would use ocamlbuild (currently comes with the compiler) or others to build it.

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