gpt4 book ai didi

macos - OS X 上的 wxHaskell

转载 作者:行者123 更新时间:2023-12-01 04:17:43 25 4
gpt4 key购买 nike

我想在 OS X(Snow Leopard、MacBook Pro)上使用 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]

确实会按照指定的方式显示一个带有单个按钮的窗口。然而,当我点击按钮时,什么也没有发生——我什至没有看到按钮变成蓝色的视觉 react ,表明它被按下了(哈哈,没有双关语)。

我听说你必须在 wxHaskell 二进制文件上运行一个名为“macosx-app”的包才能让它们运行,但我在任何地方都找不到。它不在我的机器上或(据我所知)在 WX 或 wxHaskell 发行版中。

有谁知道我需要做什么才能让它发挥作用?

最佳答案

source release包含一个名为 macosx-app-template 的文件在 bin目录。此文件被 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-templatemacosx-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不在您的路径中,您也需要更改该行。

关于macos - OS X 上的 wxHaskell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3029385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com