如何将.fs文件编译成.exe? [英] How to compile a .fs file into a .exe?
问题描述
我找不到将简单文件(.fs)编译为.exe的方法。我尝试了这个示例,但它不起作用:
I do not find a way to compile a simple file (.fs) to a .exe. I tried this example and it does not work:
-
在文件dolphin.fs中:
In the file dolphin.fs:
let longBeaked = "Delphinus capensis"
let shortBeaked = "Delphinus delphis"
let dolphins = [ longBeaked; shortBeaked ]
printfn "Known Dolphins: %A" dolphins
您现在可以
You can now compile this code to an EXE as shown here:
C:\fsharp> fsc dolphins.fs
C:\fsharp> dir dolphins.exe
但是当我这样做时 C:Cfsharp上的:上发生错误
But when I do this an error occurs on the ":" from "C:\fsharp"
推荐答案
这似乎有些错误-除了实际上,您不应该键入第一位(如svick所述),您可能还需要指定F#编译器的完整路径。如果您使用的是Visual Studio 2010附带的F#,则需要:
This seems a bit wrong - aside from the fact that you're not supposed to type the first bit (as explained by svick), you probably also need to specify the full path to the F# compiler. If you're using F# that comes with Visual Studio 2010, then you need:
"C:\Program Files (x86)\Microsoft F#\v4.0\Fsc.exe" dolphins.fs
如果如果使用的是F#的独立安装,则需要将F#编译器放置在其他位置(可能在程序文件(x86)\FSharp-2.0.0.0中,但我不确定)。另外,我不确定 dir
命令应该做什么。要执行已编译的应用程序(一旦被编译),只需键入:
If you're using standalone installation of F#, then you'll need to locate the F# compiler somewhere else (probably in "Program Files (x86)\FSharp-2.0.0.0", but I'm not exactly sure). Also, I'm not sure what is the dir
command supposed to do. To execute the compiled application (once it is compiled), you can just type:
doplhins.exe
这篇关于如何将.fs文件编译成.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!