简体   繁体   中英

Ocaml: Unbound module Array

Why doesn't work?

let data = [| 1; 2; 3; 4; |] in
  let len = Array.length data in
    for i = 0 to len do
      Printf.printf "%d\n" i
    done

ocamlc array.ml -c array.byte Displays an error is Unbound module Array

This might come from the name of your source code : array.ml which collapse with the name of the module you wish to use.

Just change the name of your file to sth else, and you should compile succesfully.

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