2010-04-28 103 views
2

我已经使用cabal安装了GD包(http://hackage.haskell.org/package/gd-3000.4.0)。当我尝试编译它使用GD的节目,我收到一个错误:用Haskell GD绑定生成错误

[[email protected]:~/jpp/haskell]$ ghc gd.hs 
compilation IS NOT required 
gd.o: In function `sV8_info': 
(.text+0x1bf): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure' 
gd.o: In function `sUY_info': 
(.text+0x3be): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure' 
gd.o: In function `sUI_info': 
(.text+0x51a): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure' 
gd.o: In function `sUI_info': 
(.text+0x6a5): undefined reference to `__stginit_gdzm3000zi4zi0_GraphicsziGD_' 
gd.o: In function `sVc_srt': 
(.data+0x34): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_drawLine_closure' 
gd.o: In function `sVc_srt': 
(.data+0x38): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_saveJpegFile_closure' 
gd.o: In function `sUI_srt': 
(.data+0x4c): undefined reference to `gdzm3000zi4zi0_GraphicsziGD_newImage_closure' 
collect2: ld returned 1 exit status 

回答

2

GD包提供了用C编写的GD库的绑定。您需要将C库链接到您的程序。尝试--make选项GHC第一:

ghc --make gd.hs 

GHC与--make会自动计算依赖关系和正确链接多模块程序。您也可以考虑手动使用-l-L选项。

0

消息像这可能表明文件做其实需要重新编译。尝试ghc -fforce-recomp