我想在OS X(雪豹,MacBook专业版)上使用wxHaskell。我能够成功地安装库和下面的脚本:
module Main where
import Graphics.UI.WX
main :: IO ()
main = start hello
hello :: IO ()
hello
= do f <- frame [text := "Hello!"]
quit <- button f [text := "Quit", on command := close f]
set f [layout := widget quit]不会导致窗口显示为指定的单个按钮。然而,当我点击按钮时,什么也没有发生-我甚至没有得到按钮变成蓝色表示它被按下的视觉反应(哈哈,没有双关语的意思)。
我听说你必须在wxHaskell二进制文件上运行一个名为"macosx-app“的包才能让它们运行,但我在任何地方都找不到这个包。它不在我的机器上,也不在WX或wxHaskell发行版中(据我所知)。
有人知道我需要做些什么才能让它工作吗?
发布于 2010-06-13 03:28:44
source release在bin目录中包含一个名为macosx-app-template的文件。configure脚本的以下部分使用此文件来创建macosx-app
cat > config/macosx-app-temp << EOF
#!/bin/sh
rezcomp="$wxinstallrezcomp"
rezfile="$wxinstallrezfile"
EOF
cat config/macosx-app-temp bin/macosx-app-template > config/macosx-app
rm -f config/macosx-app-temp
chmod a+x config/macosx-app如果您已经安装了wxHaskell并且没有使用configure脚本,那么您可能只需重复这些步骤-即,将macosx-app-template复制到macosx-app,使其成为可执行文件,然后在顶部添加以下行:
#!/bin/sh
libdir=""
wxrezcomp="`wx-config --rezflags`"
wxrezfile=""
if test "$wxrezcomp"; then
for word in $wxrezcomp; do
temp="`echo $word | grep '[^_]*_mac-[^r]*r'`"
if test "$temp"; then
wxrezfile="$temp"
fi
done
fi
if test "$wxrezfile"; then
wxrezdir="`echo $wxrezfile | sed -e 's|\(.*\)/libwx_mac.*|\1|'`"
wxinstallrezcomp="`echo \"${wxrezcomp}\" | sed -e \"s|${wxrezdir}|${libdir}|g\"`"
wxinstallrezfile="`echo \"${wxrezfile}\" | sed -e \"s|${wxrezdir}|${libdir}|g\"`"
fi
rezcomp="$wxinstallrezcomp"
rezfile="$wxinstallrezfile"请注意,您需要更改libdir=""以指定安装wxHaskell库文件的目录,如果wx-config不在path中,则还需要更改该行。
发布于 2011-03-03 04:43:05
我使用cabal安装了wxhaskell,为了让macosx-app正常工作,我按照以下步骤阅读了其他解释:
我从http://haskell.org/haskellwiki/WxHaskell/Download
wxhaskell-src-XXX.zip
其中XXX是版本号。我在解压缩后的目录中运行
.configure
sudo cp config/macosx-app /usr/local/bin
的目录
这对我很有效!
https://stackoverflow.com/questions/3029385
复制相似问题