I’m new to haskell and I’m trying to do my exercise for my class, I’ve written up the following and tried evaluating the main it but it spits out an error. (In WinGHCi)
Loading package GLUT-2.3.0.0 ... can't load .so/.DLL for: glut32 (addDLL: could not load DLL)
I’ve tried adding the glut32.dll to my system32 folder and running it again but the same error still pops up. Can someone tell me whats going on?
Heres my code:
import Graphics.Gloss
main = display (InWindow “Exercise One” (200, 200) (10, 10)) black picture
picture = color red (rectangleWire 198 198)
when I compile through powershell using ghc -o test test.hs and ./test and it spits out an error: one.exe: user error (unknown GLUT entry glutInit)
Any help would be appreciated!
You put the glut32.dll file in your system32 directory but if you’re on a 64-bit version of windows, it needs to go in your Windows\SysWOW64 directory, with the other 32-bit binaries.
For historical reasons, system32 holds the native OS binaries and are only actually 32-bit on 32-bit windows versions. Despite the name, the binaries in system32 are 64-bit on 64-bit Windows and the 32-bit files go in SysWOW64.
GHC does not have a Win64 port at this time, so it needs the 32-bit glut32.dll.
You could also try putting the glut32.dll in the same directory as the exe you’re building.
There is more than one version of glut for Windows; I’d recommend one of the (32 bit) binary builds of freeglut.