Search code examples
haskellopenglglutfreeglut

GLUT Error in Haskell Program


I'm using OpenGL with Haskell. I tried a sample program, it compiled successfully using ghc Compiler but when I run it, I get this error

user error (unknown GLUT entry glutInit)

I searched about this but most of the answers were related to this problem occurring is mac OS X and Windows. But I am getting this error on Ubuntu 15.

This Question was Previously asked but is related to windows

Below is the Sample Program that I used.

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 ]

Solution

  • The problem is that your system is missing the required shared library. On Ubuntu (and similar systems), you can install it with this simple command in a terminal:

    sudo apt-get install freeglut3