我刚刚开始使用 F#,所以我可能缺少一些非常简单的东西,但是我遇到了一个似乎没有人遇到过的编译器错误:
签名文件“AsyncSocket”没有对应的实现文件。如果存在实现文件,则检查签名和实现文件中的“模块”和“命名空间”声明是否匹配。
我认为我的代码可能有问题,所以我从 msdn 复制了这个例子,我得到了完全相同的东西。知道发生了什么吗?
签名:
namespace Library1
module Module1 =
val function1 : int -> int
type Type1 =
new : unit -> Type1
member method1 : unit -> unit
member method2 : unit -> unit
[<Sealed>]
type Type2 =
new : unit -> Type2
member method1 : unit -> unit
member method2 : unit -> unit
[<Interface>]
type InterfaceType1 =
abstract member method1 : int -> int
abstract member method2 : string -> unit
执行:
namespace Library1
module Module1 =
let function1 x = x + 1
type Type1() =
member type1.method1() =
printfn "test1.method1"
member type1.method2() =
printfn "test1.method2"
[<Sealed>]
type Type2() =
member type2.method1() =
printfn "test1.method1"
member type1.method2() =
printfn "test1.method2"
[<Interface>]
type InterfaceType1 =
abstract member method1 : int -> int
abstract member method2 : string -> unit