Dear Jens,

the problem is quite simple, but alas, the error message leaves much
to be disired: standalone Haskell program must contain a `main'
function in the `Main' module (thus the missing Main_main_closure
reference).  Furthermore, this `main' function must have the type
signature `IO ()' (or was that finally changed to `IO a'?).

In essence, you have just given a function (`add'), but not specified
how your program should interact with the world.  To do this you could 
add a module like:

  module Main where
  import Add
  main = print (add 42 1729)

and compile with

  ghc -c Add.hs (file and module name must be identical)
  ghc -c Main.hs
  ghc -o Main Main.o Add.o

Best regards,
  Tommy


[EMAIL PROTECTED] wrote/a ecrit/skrev:
> Dear Sir or Madam
> 
> I have written this small simple program
> 
> module Add where
> add :: Int -> Int -> Int
> add    x1     x2     x1 + x2
> 
> I have create an object file with the command % ghc -c additon.hs
> Now I will create an executable file.
> What I have to do?
> 
> The command % ghc -o addition addition.o give me following failure message:
> 
> /usr/lib/ghc-4.02/libHS.a(PrelMain__8.0)(.text+0x2a)
> undefined reference to 'Main_main_closure'
> /usr/lib/ghc-4.02/libHS.a(PrelMain__8.0)(.data+0xc)
> undefined reference to 'Main_main_closure'
> 
> If you can help me, please contact me under:
> 
> [EMAIL PROTECTED]
> 
> I use a Red Hat 5.1 system and GHC 4.02 .
> 
> Yours sincerely
> 
> Jens Fiedler


Reply via email to