Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos OSX上的wxHaskell_Macos_Haskell_Wxwidgets - Fatal编程技术网

Macos OSX上的wxHaskell

Macos OSX上的wxHaskell,macos,haskell,wxwidgets,Macos,Haskell,Wxwidgets,我想在OSX(雪豹,MacBookPro)上使用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 := cl

我想在OSX(雪豹,MacBookPro)上使用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]
modulemain其中
导入Graphics.UI.WX
main::IO()
main=start hello
你好::IO()
你好
=do f在
bin
目录中包含一个名为
macosx应用程序模板
的文件。
configure
脚本的以下部分使用此文件创建
macosx应用程序

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

请注意,您需要更改
libdir=”“
以指定安装wxHaskell库文件的目录,如果
wx config
不在您的路径中,您也需要更改该行。

我使用cabal安装了wxHaskell,为了让macosx应用程序正常工作,我阅读了其他解释,如下所示:

  • 我从

  • 我解压缩下载的文件:

    wxhaskell-src-XXX.zip

    其中XXX是版本号

  • 我在解压缩的目录中运行configure。 这将从模板创建文件config/macosx app

    。配置

  • 我使用sudo将文件复制到bin目录/usr/local/bin

    sudo cp config/macosx app/usr/local/bin

  • 我删除带有源文件的目录


  • 那对我有用

    你按照麦克的指示走了?是的,除了“/usr/local/wxhaskell/bin/macosx app-v helloworld”命令缺失之外,一切都很好……现在看来,wxhaskell(0.12.1.6)是通过阴谋集团分发的;Cabal从Hackage下载的tar.gz文件缺少bin/子目录条目,更不用说macosx应用程序模板了。我们这些Mac电脑迷还有希望吗?
    #!/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"