Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] compilation_problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] compilation problem
> ****
>  open Unix
>       let my_name =Unix.gethostname();;
> ******
> I type
>  ocamlc -custom unix.cma -cclib -lunix  
> and then
>  ocamlc -o pascal
> obtaining the following message:
>  Reference to undefined global `Unix'  
> I would want the exec -file.

The first command you typed is also used to create an executable (by default
a.out), since you did not provide the -c (compile only) or -a (create a library)

Change the first command to :
ocamlc -o pascal -custom unix.cma -cclib -lunix 

to create the executable with the name 'pascal'.

You could also have compiled :
ocamlc -c  (creates pascal.cmo and pascal.cmi)

then you could have created an executable with the compiled file :
ocamlc -o pascal -custom unix.cma -cclib -lunix pascal.cmo

Maxence Guesdon
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: