简体   繁体   中英

OCaml graphics package

I have installed OCaml on my xfce and now I want to do some graphics program. The problem is that I don't know how I can install graphics.cma ( I think it's this file that I need but i'm not sure ).

I have research on Google and in This forum but I can't find it..

After little search, I see that i have graphics.cma and graphics.cmxa .

I found this with ls $(ocamlc -where) | egrep cmx?als $(ocamlc -where) | egrep cmx?a

I don't know why but yet, my graphics function work at all. Sorry for inconvenience.

Thanks for helping me guys. Have a nice day

I would suggest installing and using ocamlfind in order to not have to worry about library location:

ocamlfind ocamlc -package graphics -linkpkg  test.ml

will compile your file with the right files loaded. You can also load the package in the toplevel using

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

You have already installed the graphics module.

On Debian based systems the ocaml package is split into ocaml-base-nox and ocaml-base. The later contains the graphics module while the former is trimmed down.

The ocaml package is a meta package that depends on both of those and the description says (at the end):

This package contains everything needed to develop OCaml applications,
including the graphics libraries.

So you are all set to play with graphics. Juliens answere of installing ocamlfind is a good idea though as it makes using graphics and other modules easier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM