[Haskell-cafe] Re: SOE/GLFW compilation problems
apfelmus at quantentunnel.de
Sun Oct 7 12:46:40 EDT 2007
Joel Stanley wrote:
> I've recently been able to get the SOE/GLFW code up and running from
> 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:
> 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
for an example Makefile that shows how it's done.
More information about the Haskell-Cafe