[Haskell-cafe] Compiling with NHC98

David Menendez zednenem at psualum.com
Sat May 7 17:09:29 EDT 2005


Daniel Carrera writes:

> David Menendez wrote:
> 
> > You mentioned later that you don't have any *.hi files, so I'm
> > guessing you didn't compile RC4.hs before you compiled prng.hs.
> 
> Correct. I didn't know I had to :-)

Yeah, that's one of the major differences between using an interpreter
like Hugs or ruby and a compiler. (GHC does offer a --make option that
chases down dependencies for you.)

> > Once that step is done, you should be able to compile prng.hs.
> 
> Interestingly, I get a different error now:
> 
> $ nhc98 prng.hs -o prng
> Undefined                       first referenced
>   symbol                             in file
> FN_RC4_46rand                       ./prng.o
> ld: fatal: Symbol referencing errors. No output written to prng
> collect2: ld returned 1 exit status

I haven't used NHC so I can't guarantee this will work, but try doing
something like this:

    $ nhc98 -c RC4.hs
    $ nhc98 -c prng.hs
    $ nhc98 RC4.o prng.o -o prng

The first two steps will create (unlinked) object files, and the third
step should link them together into an executable file "prng".
-- 
David Menendez <zednenem at psualum.com> <http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list