2010-04-28 91 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