[HOpenGL] compiling problem on Sven's tutorial sample

Sven Panne Sven.Panne at aedion.de
Thu May 27 03:58:58 EDT 2004


Shiqi Cao wrote:
> I tried to compile the sample code in Sven's tutorial. 
> 
> root at 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 at 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#OPTIONS-LINKER

Cheers,
    S.



More information about the HOpenGL mailing list