I started programming with Ocaml 2 days ago, I have been through the basic stuff and I wanted to start trying to create Processes.
In the book I am using the tell me to use the Unix module, so far so good…
But I get this error when I try to run a simple code that prints the time:
open Unix ;;
let t = Unix.localtime (Unix.time ());;
Printf.printf "Today is day %d of the current year.\n" t.tm_yday ;;
And I get this error:
Error: Unbound module Unix
I searched for an answer to this and I found I should compile my code with “unix.cma” linked, after this I was able to compile, but the code does nothing.
I know it might be a very noobish question, but I can’t keep going on without this.
Is a library missing?
If I run in top level it says the #load is and unbound value also!
Thank you for your time!
Edit:
I recompile it with the “unix.cma” linked, and obtained the same error:
Error: Unbound module Unix
Might be a library issue?
I did ocamlc -where and it all seems fine, meaning all the usual libraries are in the PATH, including unix.cma
Solved
It was all due to a bad installation of Ocaml. Thank you Jeffrey Scofield
It works here for me. Here is a toplevel session (Mac OS X 10.8.2):
Here is a session with the compiler:
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?