
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@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@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