2017-04-06 66 views
3

我正在使用OpenGL和Haskell。我尝试了样本程序,它使用GHC编译器编译成功,但是当我运行它,我得到这个错误Haskell程序中的GLUT错误

用户错误(未知GLUT进入glutInit)

我搜索了关于这一点,但大部分的答案均与发生此问题的是Mac OS X和Windows。但我在Ubuntu 15.收到此错误

This Question was Previously asked but is related to windows

下面是我使用的示例程序。

import Graphics.Rendering.OpenGL 
import Graphics.UI.GLUT 

main :: IO() 
main = do 
    (_progName, _args) <- getArgsAndInitialize 
    _window <- createWindow "Hello World" 
    displayCallback $= display 
    mainLoop 

display :: IO() 
display = do 
    clear [ ColorBuffer ] 
+0

你能否提供你的代码和例子,这将有助于我想象。 –

+2

试试'sudo apt-get install freeglut3' – user2297560

+0

@ user2297560谢谢你在这里分享,它解决了我的问题。 –

回答

2

问题是您的系统缺少所需的共享库。在Ubuntu(以及类似的系统)上,你可以用这个简单的命令在终端中安装它:

sudo apt-get install freeglut3