开发者

Running F# code with Mono

开发者 https://www.devze.com 2023-01-19 14:37 出处:网络
I have F# 2.0.0 installed, and use mono 2.8. let rec fib n = match n with 1 | 2 -> 1 n -> fib(n-1) + fib(n-2)

I have F# 2.0.0 installed, and use mono 2.8.

let rec fib n =
    match n with
    | 1 | 2 -> 1
    | n -> fib(n-1) + fib(n-2)

let n = 40
let x = fib(n)
printfn "%d" x

I compiled this code with fsc.exe to get fib.exe. Running开发者_StackOverflow this with mono fib.exe gives me this error.

mono fact.exe 
Could not load file or assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

Unhandled Exception: System.TypeLoadException: Could not load type 
'.$Factorial' from assembly 'factorial, Version=0.0.0.0,
 Culture=neutral, PublicKeyToken=null'.

What might be wrong?

ADDED

sudo gacutil -i FSharp.Core.dll 

solved this problem.


The F# assemblies (like FSharp.Core.dll) are probably only installed to the .Net GAC. You need to install them to Mono's GAC (Mono's gacutil.exe), or copy the assemblies into the same directory as your executable.

0

精彩评论

暂无评论...
验证码 换一张
取 消