如何在Mac OS上运行简单的f#程序

时间:2014-11-28 14:53:18

标签: f# mono xamarin

我已经安装了Xamarin来学习F#并编写一个简单的程序:

[<EntryPoint>]
let main args = 
    printfn "%d" 10
    0

如果我从Xamarin Studio启动它,一切正常。但是如果我尝试从控制台编译并运行它,我会得到错误:

$ fsharpc some.fs
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License

# demas at MacBook-Air-demas.local in ~/temporary [17:47:22]
$ ./some.exe
zsh: exec format error: ./some.exe

我该如何解决?

1 个答案:

答案 0 :(得分:8)

尝试:

mono some.exe

或完整路径:

/usr/bin/mono ./some.exe

http://www.mono-project.com/archived/guiderunning_mono_applications/