[HOpenGL] Compiling HOpenGL Examples with GHC 6.2 Mac OS
Sven Panne
Sven.Panne at aedion.de
Tue Jan 6 13:45:41 EST 2004
Hans Nikolaus Beck wrote:
> I'm a Haskell newbee and try to compile the HOpenGL Examples with GHC
> 6.2 Mac OS X with it's build in openGL stuff [...]
I guess you are using the GHC.6.2.dmg from the GHC download page. The
problem is that the examples from the HOpenGL tar files are for the
old API, for a slightly longer explanation see:
http://haskell.org/pipermail/hopengl/2003-December/000454.html
> ghc --make Cube.hs
That's fine, --make is all that is needed, but you should use the examples
written for the new API. I don't know if they are shipped with the Mac OS X
installer, but the bleeding edge examples are always available from:
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/examples/
> [...] But how to say ghc what he needs ? Is it -addpackage or -l option (in
> other words "import" is the same as include in C?) ?
There are actually two parts:
* By simply writing
import Graphics.UI.GLUT
in your Haskell source you get all the definitions from the GLUT package
plus all the ones from the OpenGL package (i.e. GLU and GL stuff). This
is quite similar to
#include <GL/glut.h>
* You don't need the equivalents of "-I<blah>" or "-l<foo>" to build an
executable using the GLUT/OpenGL packages when you use "--make".
Everything is automagically handled behind the scenes. An explicit
"-package GLUT" is only needed when you compile and link separately,
see:
http://haskell.org/ghc/docs/latest/html/users_guide/packages.html
Cheers,
S.
More information about the HOpenGL
mailing list