<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/12/870fe08760fc2e92b95c37dd5aa5e54d"
  from="Maxence Guesdon &lt;maxence.guesdon@i...&gt;"
  author="Maxence Guesdon"
  date="2002-12-03T07:44:45"
  subject="Re: [Caml-list] compilation problem"
  prev="2002/12/997b51ec2b0df44ae211697f2b71d18f"
  next="2002/12/5d66a1963f1b171240f82ba50076fc0a"
  prev-in-thread="2002/12/838549db9eab58c179d31f32eefdf381"
  prev-thread="2002/12/67f44329195eaf652b43093fd3ca01ba"
  next-thread="2002/12/28fc7801c74d2b5e69dc9c4f54d9779e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] compilation_problem">
<msg 
  url="2002/12/838549db9eab58c179d31f32eefdf381"
  from="altavillasalvatore@libero.it &lt;altavillasalvatore@l...&gt;"
  author="altavillasalvatore@libero.it"
  date="2002-12-02T18:23:47"
  subject="[Caml-list] compilation_problem">
<msg 
  url="2002/12/870fe08760fc2e92b95c37dd5aa5e54d"
  from="Maxence Guesdon &lt;maxence.guesdon@i...&gt;"
  author="Maxence Guesdon"
  date="2002-12-03T07:44:45"
  subject="Re: [Caml-list] compilation problem">
</msg>
</msg>
</thread>

<contents>
&gt; 
&gt; ****
&gt; pascal.ml
&gt;  open Unix
&gt;       let my_name =Unix.gethostname();;
&gt; ******
&gt; I type
&gt; 
&gt;  ocamlc -custom unix.cma pascal.ml -cclib -lunix  
&gt; 
&gt; and then
&gt; 
&gt;  ocamlc pascal.ml -o pascal
&gt; 
&gt; obtaining the following message:
&gt; 
&gt;  Reference to undefined global `Unix'  
&gt; 
&gt; 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

</contents>

</message>

