问题
I'm basically trying to follow this stackoverflow answer located in this post:
What is the best module for HttpRequest in OCaml
and I'm running in to problems. When I am trying to run a single file with just
open Lwt ;;
I am getting and error saying it is an unbound module. I have run the following opam instruction:
opam install lwt
and it did install the correct package.
So I think the problem is the difference between a module and a package, which I don't really understand. I was looking at this question as a possible answer, but I wasn't sure if it was what I needed.
Unbound modules in OCaml
Thanks for the input guys, I'm new to Ocaml and I'm trying to learn the ins and outs of building something.
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/16681939/difference-between-module-and-package-ocaml