Linux Mint上的未绑定模块图形Ocaml

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

我已经阅读了多个相同的问题,但答案无法解决。OCaml顶层,版本4.11.0 + dev0-2019-10-18opam列表

# Packages matching: installed
# Name              # Installed # Synopsis
base-bigarray       base
base-threads        base
base-unix           base
conf-libX11         1           Virtual package relying on an Xlib system instal
conf-pkg-config     1.1         Virtual package relying on pkg-config installati
dune                2.4.0       Fast, portable, and opinionated build system
dune-configurator   2.4.0       Helper library for gathering system configuratio
dune-private-libs   2.4.0       Private libraries of Dune
graphics            5.1.0       The OCaml graphics library
ocaml               4.10.0      The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.0      Official release 4.10.0
ocaml-config        1           OCaml Switch Configuration

opam安装图形[注意]软件包图形已经安装(当前版本是5.1.0)。

ocamlfind查询-谓词本机-a格式图形

ocamlfind: Package `graphics' not found
me@2020:~$   /home/ivg/.opam/fresh/lib/ocaml/graphics.cmxa
bash: /home/ivg/.opam/fresh/lib/ocaml/graphics.cmxa: Aucun fichier ou dossier de ce type

ocamlfind ocamlopt-程序包图形

ocamlfind: Package `graphics' not found

lsocamlc -where/图形*

ls: impossible d'accéder à '/usr/local/lib/ocaml/graphics*': Aucun fichier ou dossier de ce type

sudo apt安装libx11-dev

Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
libx11-dev est déjà la version la plus récente (2:1.6.4-3ubuntu0.2).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 8 non mis à jour.

我不明白这是什么问题,它似乎已安装但无法正确使用?

ocamlc graphics.cma test1.ml -o test1

File "test1.ml", line 3, characters 5-13:
3 | open Graphics;;
         ^^^^^^^^
Error: Unbound module Graphics
graphics compilation ocaml libraries unbound
1个回答
0
投票

来自https://caml.inria.fr/

自OCaml 4.09起,图形库作为外部对象分发包。

因此,您必须指定ocamlc,使用-I选项和ocamlfind在哪里找到相应的cma文件::

ocamlc -I $(ocamlfind query graphics) graphics.cma test1.ml -o test1
© www.soinside.com 2019 - 2024. All rights reserved.