How to compile a .fs file into a .exe?

陌路散爱 提交于 2019-12-05 12:25:05

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

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

You're not supposed to type the whole line. The C:\fsharp> part represents the command line prompt. You should just type fsc dolhins.fs and then dir dolphins.exe.

The error messages sound like you're typing command-prompt commands into F# interactive.

Try opening the "Visual Studio Command Prompt" from your start menu, changing to the right directory, and typing your commands there.

Alternately, create a new F# Application project in Visual Studio, add your .fs file to the project, and build it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!