试图使Gloss Graphics库正常工作

Pet*_*all 5 graphics haskell

我试图从示例中找到一个简单的haskell图形库,而Gloss似乎很简单.

我举了一个非常简单的例子,但我很难让它发挥作用.

import Graphics.Gloss
displayInWindow "My Window" (200, 200) (10, 10) blue (circle 80)
Run Code Online (Sandbox Code Playgroud)

编译ghc test.hs我得到:

 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
Run Code Online (Sandbox Code Playgroud)

稍微用ghci的更大的成功.运行相同的代码,我会出现一个白色矩形,但它不会绘制任何内容并且没有响应.我必须退出进程以取回对终端的控制权.

如果其他东西更合适,我也会对替代图形库感兴趣.我发现要知道哪些库值得一看有点困难.我的要求很模糊,我只想在屏幕上画一些东西.

我正在使用Mac OS X 10.6.8

Dan*_*ner 5

您可能只需要使用ghc --make test.hs.较新版本ghc使--make默认.