Haskell GD绑定的生成错误

Haskell GD绑定的生成错误,haskell,gd,ghc,Haskell,Gd,Ghc,我已经使用cabal安装了GD包()。当我试图编译使用GD的程序时,我收到一个错误: [mp262554@students:~/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 functi

我已经使用cabal安装了GD包()。当我试图编译使用GD的程序时,我收到一个错误:

[mp262554@students:~/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

这样的消息可能表明文件实际上需要重新编译。试试ghc-fforce recomp

GD包提供了到用C编写的GD库的绑定。您需要将C库链接到您的程序。请尝试
--首先设置GHC的
选项:

 ghc --make gd.hs
带有
--make
的GHC应自动计算相关性,并正确链接多模块程序。您也可以考虑手动使用<代码> -L 和<代码> -L>代码>选项。