OCaml 中的编译错误
Compile error in OCaml
我是 OCaml 的新手,我不知道如何编译它:
我有这个 labyrinthe.mli :
type is = bool
type ouverte = bool
type case = (is)
type porte = (ouverte * case * case)
type lab = (case * porte * porte * porte * porte)
val create_case : is -> case
val create_porte : ouverte -> case -> case -> porte
val create_lab : case -> porte -> porte -> porte -> porte -> lab
和这个 main.ml :
let c1 = Labyrinthe.create_case false
let c2 = Labyrinthe.create_case false
let c3 = Labyrinthe.create_case false
let c4 = Labyrinthe.create_case false
let case = Labyrinthe.create_case true
let p1 = Labyrinthe.create_porte false case c1
let p2 = Labyrinthe.create_porte false case c2
let p3 = Labyrinthe.create_porte false case c3
let p4 = Labyrinthe.create_porte false case c4
let lab = Labyrinthe.create_lab case p1 p2 p3 p4
我这样编译两个文件:ocamlopt labrinthe.mli main.ml 但它不起作用。
我收到以下消息错误:文件 "main.ml",第 1 行:
错误:没有为以下模块提供实现:
迷宫引用自 main.cmx
我已经尝试了我在互联网上找到的所有方法,但没有任何效果:(
有人可以帮我吗?
您没有提供迷宫界面的实现。没有实现就无法创建可执行文件。毕竟,当你调用时应该执行什么代码,例如,create_case
in main?
如果要单独编译,可以使用-c
标志创建目标文件。然后,您可以 link 该目标文件和包含 labyrinthe 实现的目标文件来创建可执行文件。
我是 OCaml 的新手,我不知道如何编译它:
我有这个 labyrinthe.mli :
type is = bool
type ouverte = bool
type case = (is)
type porte = (ouverte * case * case)
type lab = (case * porte * porte * porte * porte)
val create_case : is -> case
val create_porte : ouverte -> case -> case -> porte
val create_lab : case -> porte -> porte -> porte -> porte -> lab
和这个 main.ml :
let c1 = Labyrinthe.create_case false
let c2 = Labyrinthe.create_case false
let c3 = Labyrinthe.create_case false
let c4 = Labyrinthe.create_case false
let case = Labyrinthe.create_case true
let p1 = Labyrinthe.create_porte false case c1
let p2 = Labyrinthe.create_porte false case c2
let p3 = Labyrinthe.create_porte false case c3
let p4 = Labyrinthe.create_porte false case c4
let lab = Labyrinthe.create_lab case p1 p2 p3 p4
我这样编译两个文件:ocamlopt labrinthe.mli main.ml 但它不起作用。
我收到以下消息错误:文件 "main.ml",第 1 行: 错误:没有为以下模块提供实现: 迷宫引用自 main.cmx
我已经尝试了我在互联网上找到的所有方法,但没有任何效果:( 有人可以帮我吗?
您没有提供迷宫界面的实现。没有实现就无法创建可执行文件。毕竟,当你调用时应该执行什么代码,例如,create_case
in main?
如果要单独编译,可以使用-c
标志创建目标文件。然后,您可以 link 该目标文件和包含 labyrinthe 实现的目标文件来创建可执行文件。