ocaml 未绑定模块图形

问题描述 投票:0回答:1

我是 ocaml 的新手,我一直收到这个错误,但不明白为什么。

这是我的ocaml代码:

#load "graphics";;
open Graphics;;
open_graph "";;

let etoile x y c =
  moveto (x-c/2) (y-c/2) ;
  lineto (x-c/4) y ; 
  lineto (x-c/2) (y+c/2) ;
  lineto x (y+c/2) ;
  lineto (x+c/2) (y+c/2) ;
  lineto (x+c/4) y ;
  lineto (x+c/4) (y-c/4) ;
  lineto x (y-c/2) ;
  lineto (x-c/2) (y-c/2) ;;

etoile 100 100 20;;

这是终端:

即使图形已安装,如您在终端中所见。

请帮忙解决这个问题

graphics ocaml
1个回答
0
投票

在我看来你有

#load "graphics"
但你应该有
#load "graphics.cma"
.

$ ocaml
        OCaml version 4.07.0

# #load "graphics";;
Cannot find file graphics.
# #load "graphics.cma";;
#
© www.soinside.com 2019 - 2024. All rights reserved.