Joel Stanley wrote:
I've recently been able to get the SOE/GLFW code up and running from
http://haskell.org/soe/software1.htm
and things are working well under GHCi under Mac OS X.
However, when attempting to compile a simple graphics script using ghc, I'm
getting some unexpected link errors:
$ ghc -o mygfx mygfx.hs -iSOE/src
compilation IS NOT required
/usr/bin/ld: Undefined symbols:
_SOE_Blue_closure
_SOE_Red_closure
_SOE_closeWindow_closure
_SOE_drawInWindow_closure
_SOE_ellipse_closure
_SOE_getKey_closure
_SOE_openWindow_closure
_SOE_polyline_closure
_SOE_runGraphics_closure
_SOE_withColor_closure
collect2: ld returned 1 exit status
I'm quite new to Haskell, so I'm not sure if there was something special I
had to do in order to get the code for the closures generated by ghc.
You can just use --make and ghc will figure things out automatically
ghc --make mygfx.hs -o mygfx -iSOE/src
(mygfx.hs must be the Main module for that to work, though)
If you want to do it by hand/Makefile, you need to compile ("ghc -c")
the SOE code first and then link the resulting object files ("ghc -o
mygfx SOE.o Draw.o ..."). See
http://www.haskell.org/ghc/docs/latest/html/users_guide/
separate-compilation.html#using-make
for an example Makefile that shows how it's done.
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe