简体   繁体   English

OCaml 图形包

[英]OCaml graphics package

I have installed OCaml on my xfce and now I want to do some graphics program.我已经在我的 xfce 上安装了 OCaml,现在我想做一些图形程序。 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 ).问题是我不知道如何安装 graphics.cma(我认为这是我需要的文件,但我不确定)。

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 .经过一点搜索,我看到我有 graphics.cma 和 graphics.cmxa 。

I found this with ls $(ocamlc -where) | egrep cmx?a我用ls $(ocamlc -where) | egrep cmx?a找到了这个ls $(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以便不必担心库位置:

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.在基于 Debian 的系统上,ocaml 包分为 ocaml-base-nox 和 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): ocaml 包是一个元包,它依赖于这两者,并且描述说(最后):

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. Juliens answere 安装 ocamlfind 是一个好主意,因为它使使用图形和其他模块更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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