没有为以下模块提供实现

时间:2016-11-10 21:28:09

标签: ocaml ocaml-core

我遇到corebuild的问题。我写了以下程序:

open Core.Std
open Smtp

type person = {
  name: string;
  address: Smtp_unix.Addr.t
}

let send p1 p2 =
  Smtp_unix.sendmail ~host:"gmail.google.fr"
    ~name:"gmail.google.com"
    ~from:(Smtp_unix.Addr.of_string "<hidden>")
    ~to_:[p1.address]
    ~body:("Hello "^p2.name)
    ()

let () =
  let p1 = {name="alice"; address = Smtp_unix.Addr.of_string "alice@example.com"} in
  let p2 = {name="bob"; address = Smtp_unix.Addr.of_string "bob@example.com"} in
  match send p1 p2 with
  | `Ok _ -> printf "Mail sent"
  | `Failure (_,m) -> printf "Error: %s" m

根据Merlin是正确的。要编译它,我运行以下命令

corebuild example.native -package smtp

我收到以下错误,我不明白。

Error: No implementations provided for the following modules:
         Smtp_unix referenced from example.cmx

我没有弄错。有什么想法吗?

1 个答案:

答案 0 :(得分:3)

看起来smtp需要smtp_unix。

corebuild send.native -package smtp.unix -package smtp