OCaml - Cannot find graphics.cma

前端 未结 2 1025
有刺的猬
有刺的猬 2021-01-14 08:48

When loading the Graphics module in the toplevel, I get an error saying \"Cannot find graphics.cma\".

I\'m using OS X and I\'m pretty sure I\'ve installed OCaml corr

2条回答
  •  不知归路
    2021-01-14 09:41

    The solution mostly depends on how are you compiling. If you're using ocamlbuild tool, the the following would be sufficient:

    ocamlbuild -use-ocamlfind -pkg graphics my_program.native
    

    Where my_program.native is your target. Note, you can try to omit the -use-ocamlfind flag.

    In order to bring graphics to your toplevel, the easiest solution would be to use topfind:

    # #use "topfind";;
    # #require "graphics";;
    

提交回复
热议问题