Version française
Home     About     Download     Resources     Contact us    
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
> 
> ****
> pascal.ml
>  open Unix
>       let my_name =Unix.gethostname();;
> ******
> I type
> 
>  ocamlc -custom unix.cma pascal.ml -cclib -lunix  
> 
> and then
> 
>  ocamlc pascal.ml -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)
flags.

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

to create the executable with the name 'pascal'.

You could also have compiled pascal.ml :
ocamlc -c pascal.ml  (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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners