Difference between module and package Ocaml

倖福魔咒の 提交于 2019-12-05 10:09:58

To use a "package", you must tell the compiler about it explicitly. Unbound module in OCaml usually means one of two things: your made a typo of the module name, or you failed to set a proper module search path. What compiler options do you use?

If you use ocamlfind, the compilation should look like:

ocamlfind ocamlc -package lwt -c mymodule.ml

this instructs the compiler to try to find modules in lwt package installation directory, in addition to the default ones.

if you do not use ocamlfind.... well, use ocamlfind.

The command for compiling our program will be:

ocamlfind ocamlopt -o progprog -linkpkg \
  -package lablGL,sdl,sdl.sdlimage,sdl.sdlmixer,sdl.sdlttf \
  module1.ml module2.ml

As seen on: https://ocaml.org/learn/tutorials/compiling_ocaml_projects.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!