Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:09:43+00:00 2026-06-15T09:09:43+00:00

I started programming with Ocaml 2 days ago, I have been through the basic

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:09:44+00:00Added an answer on June 15, 2026 at 9:09 am

    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.ml
    open Unix
    
    let 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
    $ doy
    Today 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?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get started with some basic Ocaml programming. To start I
I started programming in Python a couple of days ago and I have a
I started programming in Lua few days ago. I have become familiar with the
I have started programming a few weeks ago in java/android. I want to write
I started programming for windows a few days ago and having trouble displaying my
I have just started programming on iOS a couple of weeks ago, so sorry
Since I've started programming in Java I have been wondering this (about a year
I've started programming for iPhones about a month ago now, and have found the
I have started programming few years ago. and generally i use for programming C
I recently started programming with xCode and PyObjC and I'm trying to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.