[Haskell-cafe] SDL program under MinGW

Bit Connor bit at mutantlemon.com
Sun Dec 7 04:23:33 EST 2008


Did you follow the instructions described in the WIN32 file?

On Sat, Dec 6, 2008 at 2:05 PM, sam lee <skynare at gmail.com> wrote:
> Hi.
>
> I am using Windows Vista.
> I installed the following:
>
> - ghc 6.8.3 (using official Windows binary installer)
> - MinGW (from http://nuwen.net/mingw.html)
> - SDL binding (from
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL)
>
> I am trying to compile the following program:
>
>    module Main where
>
>    import qualified Graphics.UI.SDL as SDL
>
>    main = do
>        SDL.init [SDL.InitEverything]
>        SDL.quit
>
> I get the following error:
>
> C:\Users\client\code\sandbox>ghc --make Example.hs
> Linking Example.exe ...
> C:\MinGW\lib/libSDLmain.a(SDL_win32_main.o)(.text+0x409):SDL_win32_main.c:
> undefined reference to `SDL_main'
>
> According to SDL faq
> (http://www.libsdl.org/faq.php?action=listentries&category=4#48)  I
> should use "int main(int argc, char *argv[])", not "int main()" nor
> "WinMain()".
>
> Can anyone compile the above snippet on windows machine?
> I am using SDL library that is shipped with MinGW distribution that I'm using.
> I also recompiled SDL haskell binding with official SDL windows binary
> (http://www.libsdl.org/release/SDL-devel-1.2.13-mingw32.tar.gz). But I
> get the same undefined reference to SDL_main linker error.
>
> Do I need to have specific main IO action so that SDL would work in Haskell?
>
> Thank you.
> Sam.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list