我有以下源文件(sdl.hs):
module Main where
import Graphics.UI.SDL.Mixer.Music
import Graphics.UI.SDL.Mixer
import Graphics.UI.SDL
main = loadMUS ""
我尝试以下方法:
ghc --make sdl.hs
C:\Program Files (x86)\Haskell\SDL-mixer-0.6.1\ghc-7.6.3/libHSSDL-mixer-0.6.1.a(Music.o):fake:(.text+0x10): undefined reference to `Mix_FreeMusic'
...
它给了我几十个这样的错误。我已经尝试了所有可能的方法(更新、全新安装和 Google),但我对 Haskell 中的 FFI 以及它应该如何工作几乎一无所知。
一些额外的信息:
c:\>gcc --version
realgcc.exe (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
c:\>ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
c:\>cabal install sdl sdl-mixer
Resolving dependencies...
All the requested packages are already installed:
SDL-0.6.4
SDL-mixer-0.6.1
Use --reinstall if you want to reinstall anyway.
尝试启动与 GHCi 相关的任何 SDL 会得到以下结果:
Prelude> import Graphics.UI.SDL.Mixer.Music
Prelude Graphics.UI.SDL.Mixer.Music> loadMUS ""
Loading package SDL-0.6.4 ... <interactive>: Unknown PEi386 section name `.idata$4' (while processing: C:\sdl\SDL-1.2.15\lib\libSDL.dll.a)
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.6.3 for i386-unknown-mingw32):
loadArchive "C:\\sdl\\SDL-1.2.15\\lib\\libSDL.dll.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
我发现这似乎是相关的,但它已经存在了一段时间,并且没有希望看到 windows 获得建议的“修复”。