views:

81

answers:

4

I have a problem with compiling a program written in ocaml, the error appears to me is: Error: Unbound module Basics, how can I solve this problem? I state that the beginner with this language.

libraries used throughout the code are: open Basics ;; open Paritygame ;; open Univsolve;; open Solvers;;

files containing the modules are: basics.ml basics.mli, paritygame.ml paritygame.mli,univsolve.ml univsolve.mli and solvers.ml solvers.mli.....

+3  A: 

This thread at Caml forums might help.

missingfaktor
A: 

The Basics module is actually part of Camlserv, you will need to install that first.

Gaius
+7  A: 

To compile byte code use ocamlc, followed by any other files required in order, from left to right, that represents their dependencies. These files can be ocaml source code files, or compiled files (cmo). To compile the files individually to cmo, you should do something like,

ocamlc.opt -c -annot -o util.cmo util.ml
ocamlc.opt unix.cmo str.cmo util.cmo game.ml -o game

It is recommended that you include the string you used to attempt to compile the application in your answer, that should just be common sense.

libraries used throughout the code are: open Basics ;; open Paritygame ;; open Univsolve;; open Solvers;;

files containing the modules are: basics.ml basics.mli, paritygame.ml paritygame.mli,univsolve.ml univsolve.mli and solvers.ml solvers.mli.....

These are not called libraries. These are modules. A library is a collection of cmo files compiled into a cma for distribution. But all of this, really says nothing on the dependencies between the modules to tell us what you are doing wrong in the compilation. I suggest, once you get some of these basics down, that you move on to ocamlbuild. For simple projects like this, it can compile the project with literally no effort. It will resolve dependencies and compile only files that have changed since the last call.

nlucaroni
+4  A: 

Most likely you are linking the modules out of order. If you are using ocamlc or ocamlopt to link, put basics.cmo/cmx first:

ocamlc -o my_exec basics.cmo univsolv.cmo paritygame.cmo solvers.cmo

(The order above may not be correct - for example partiygame.cmo may depend on solver.cmo in which case you should switch the order.)

Or just use ocamlbuild as it takes care of all of that for you.

Niki Yoshiuchi