
Shiqi Cao wrote:
I tried to compile the sample code in Sven's tutorial.
root@linux Haskell # ghc -package GLUT -o test3 test3.o /usr/lib/ghc-6.2/libHSrts.a(Main.o)(.text+0x10): In function `main': : undefined reference to `__stginit_ZCMain' /usr/lib/ghc-6.2/libHSrts.a(Main.o)(.text+0x36): In function `main': : undefined reference to `ZCMain_main_closure' collect2: ld returned 1 exit status root@linux Haskell #
module GLtest where [...]
Under normal circumstances, the main function of a Haskell program has to be called "main" and must reside in module "Main". So you have different options to fix your problem: * Use "Main" instead of "GLtest" * Leave out the "module" line completely, so you use "Main" implictly. This is done in the tutorial, BTW. * Use GHC's "--main-is GLtest" option, see: http://haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#OPTI... Cheers, S.