Error: Unbound module Unix in Ocaml Error: Unbound module Unix in Ocaml unix unix

Error: Unbound module Unix in Ocaml


It works here for me. Here is a toplevel session (Mac OS X 10.8.2):

$ ocaml        OCaml version 4.00.0# #load "unix.cma";;# open Unix;;# let t = Unix.localtime (Unix.time ());;val t : Unix.tm =  {tm_sec = 39; tm_min = 27; tm_hour = 16; tm_mday = 3; tm_mon = 11;   tm_year = 112; tm_wday = 1; tm_yday = 337; tm_isdst = false}# Printf.printf "Today is day %d of the current year.\n" t.tm_yday;;Today is day 337 of the current year.- : unit = ()# 

Here is a session with the compiler:

$ cat doy.mlopen Unixlet t = Unix.localtime (Unix.time ());;Printf.printf "Today is day %d of the current year.\n" t.tm_yday$ ocamlc -o doy unix.cma doy.ml$ doyToday is day 337 of the current year.

If these don't work for you, my only theory is that your OCaml installation isn't complete. What type of system are you using?