Skip to content

linker reports missing symbols Main.c:(.text+0x12): undefined reference to `__stginit_ZCMain'

i use 6.8.2 on linux (ubuntu 7.10). i use mainly eclipse and ghci, but when i try to compile a program, the linker reports the undefined references. for the minimal program 'hello world' i get

Main.c:(.text+0x12): undefined reference to `__stginit_ZCMain'
Main.c:(.text+0x2c): undefined reference to `ZCMain_main_closure'

for more interesting programs i get a lot more (i have experimented with wxhaskell and phooey, tv, eros -- and some problems with compiling them in the right order etc..)

suprisingly the problem goes away if the program is called Main.hs - then it links properly, but not when it is called Test.hs. the same program with

main = putStr....

according to the ghc documentation, it is permitted to have in file Test.hs the module main. (and it works properly in ghci)

Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information