[Haskell-cafe] Code from Haskell School of Expression hanging.
Daniel Fischer
daniel.is.fischer at googlemail.com
Mon Jan 31 01:39:39 CET 2011
On Monday 31 January 2011 01:11:59, michael rice wrote:
> SimpleGraphics has a bunch of main programs: main0, main1, main2, main3,
> and main3book. I sequentially changed each to main and ran all five
> successfully.
For future use, you can do that without changing the file in between, you
can pass a module name or a function name to -main-is, in this case a
qualified function name:
$ ghc -fforce-recomp --make SimpleGraphics -main-is SimpleGraphics.main0 -o
simple0
-- that's one line, mail client wraps probably
arrow up, change main0 to main1 and the executable name, enter; repeat
until done
>
> Then I did the same for Snowflake.lhs (see code below) which already had
> a single main function.
>
> Michael
>
> ==============
>
> [michael at localhost src]$ ghc --make Snowflake -main-is Snowflake
> Linking Snowflake ...
> /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main':
> (.text+0x10): undefined reference to `ZCMain_main_closure'
> /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main':
> (.text+0x18): undefined reference to `__stginit_ZCMain'
> collect2: ld returned 1 exit status
> [michael at localhost src]$
>
> ==============
The module has not been compiled again, ghc only tries to link, but because
it wasn't told that there's going to be an executable when compiling, it
didn't create all necessary pieces.
Make sure it's recompiled, pass -fforce-recomp on the command line,
$ ghc -fforce-recomp --make Snowflake -main-is Snowflake
or
(
$ touch Snowflake.hs (perhaps, if you're on Windows, there is no touch
command)
or delete Snowflake.o and/or Snowflake.hi
), then compile with --make -main-is Snowflake
More information about the Haskell-Cafe
mailing list