Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Newbie Ocaml problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Vanier <mvanier@b...>
Subject: Re: [Caml-list] Newbie Ocaml problem

> Date: Wed, 15 Aug 2001 04:02:12 +0200
> From: Gerhard =?iso-8859-1?Q?H=E4ring?= <haering_python@gmx.de>
> 
> Hello,
> 
> I'd like to finally learn some functional programming. I thought Ocaml might be
> a good choice because it also has imperative features, so transition to a
> functional language like Ocaml is probably smoother than, say Haskell.
> 
> I started with the Ocaml tutorial, but I learn best with real problems (I'd
> like to translate a few of my Python scripts to Ocaml), so I need things from
> the standard library. In particular, I need the Unix module. And here I've hit
> a problem:
> 
> gerhard@lilith:~ > ocaml
> Objective Caml version 3.02
> 
> # Sys.os_type;;
> - : string = "Unix"
> # Unix.getpid;;
> Reference to undefined global `Unix'
> #
> 
> I can use the Sys module, but whenever I try to use stuff from the Unix module,
> I get the error message above. It must be something obvious I am missing. But
> what?
> 
> Thanks,
> 
> Gerhard

>From the online docs:

Programs that use the unix library must be linked as follows: 

        ocamlc other options unix.cma other files
        ocamlopt other options unix.cmxa other files

For interactive use of the unix library, do: 

        ocamlmktop -o mytop unix.cma
        ./mytop

Mike

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr