I'm trying to find a simple graphics library for haskell and Gloss seemed simple, from the examples.
I've taken a very simple example, but I'm struggling to get it to work.
import Graphics.Gloss
displayInWindow "My Window" (200, 200) (10, 10) blue (circle 80)
Compiling with ghc test.hs
I get:
compilation IS NOT required
Undefined symbols:
"_glosszm1zi3zi4zi1_GraphicsziGlossziDataziColor_blue_closure", referenced from:
_Main_main_info in test.o
_Main_main_srt in test.o
"_glosszm1zi3zi4zi1_GraphicsziGlossziDataziPicture_circle_closure", referenced from:
_spy_info in test.o
_spy_srt in test.o
"___stginit_glosszm1zi3zi4zi1_GraphicsziGloss_", referenced from:
___stginit_Main_ in test.o
"_glosszm1zi3zi4zi1_GraphicsziGlossziInternalsziInterfaceziDisplay_displayInWindow_closure", referenced from:
_Main_main_info in test.o
_Main_main_srt in test.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I have slightly more success with ghci. Running the same code, I get a white rectangle to appear, but it doesn't draw anything and is unresponsive. I have to quit the process to get back control of my terminal.
I'd also be interested in alternative graphics libraries if something else is more suitable. I'm finding it a bit difficult to know what libraries are worth looking at. My requirements are vague, I just want to draw something to the screen.
I'm using Mac OS X 10.6.8
You probably just need to use ghc --make test.hs
instead. Newer versions of ghc
make --make
the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With