# "No implementations provided" strange error with ocamlopt

**URL:** <https://discuss.ocaml.org/t/no-implementations-provided-strange-error-with-ocamlopt/3693>\
**Category:** Learning\
**Created:** [April 22, 2019, 8:49am UTC](https://discuss.ocaml.org/t/no-implementations-provided-strange-error-with-ocamlopt/3693 "2019-04-22T08:49:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathandoyle](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jonathandoyle](https://discuss.ocaml.org/u/jonathandoyle)\
**Post date:** [April 22, 2019, 8:49am UTC](https://discuss.ocaml.org/t/no-implementations-provided-strange-error-with-ocamlopt/3693/1 "2019-04-22T08:49:17Z")

</div>

I am currently encountering a “No implementations provided for the following modules” error. Google showed me dozens of pages about this issue, but it seems none of them deals with the particular issue I’m having. They’re all in the context of high-level tools such as `ocamlfind` or `jbuilder` , while I found this issue using only `ocamlopt`.  
I have a file named `a.ml` whose one-line content is `let v=7;;`.  
I also have another file named `b.ml` whose one-line content is `let w=1+A.v;;`.

The following output leaves me perplexed :

![disk](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/2/2e8379c1e511e7225865383bbd29b4ce2a951b87.png)

Here are my questions :

1. Why is `ocamlopt` complaining that it was not provided the implementation of A when I provided both the `.cmx` and `.o` file ?  
(and shouldn’t `ocamlopt` find those files on its own anyway, as `ocamlc` does for cmo files ?)

2. Despite the error message, the `b.ml` file is actually compiled it seems. So is it a fake error message, or should I worry ?

---

<div class="post-metadata">

**Author:** ![yallop](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yallop/32/517_2.png) [@yallop](https://discuss.ocaml.org/u/yallop)\
**Post date:** [April 22, 2019, 9:46am UTC](https://discuss.ocaml.org/t/no-implementations-provided-strange-error-with-ocamlopt/3693/2 "2019-04-22T09:46:11Z")

</div>

> 1. Why is `ocamlopt` complaining that it was not provided the implementation of A when I provided both the `.cmx` and `.o` file ?

The order in which the files are provided is significant. Since `B` makes use of `A`, `a.cmx` should appear before `b.ml` on the command line:

```auto
$ ocamlopt -o b.exe a.cmx b.ml

```

> Despite the error message, the `b.ml` file is actually compiled it seems. So is it a fake error message, or should I worry ?

The error message is from the linker, not the compiler. So `b.ml` is compiled successfully into `b.cmx`, but linking `a.cmx` and `b.cmx` together fails, because the order of filenames on the command-line doesn’t match the dependency order between modules.

Breaking things down into separate steps is likely to make things easier to understand. The first step is to compile (but not link) both `a.ml` and `b.ml` by passing `-c` to the compiler:

```auto
$ ls
a.ml b.ml
$ ocamlopt -c a.ml
$ ocamlopt -c b.ml
$ ls
a.cmi a.cmx a.ml a.o b.cmi b.cmx b.ml b.o

```

The second step is to link together the object files (`.cmx`, not `.ml`) from the first step:

```auto
$ ocamlopt -o b.exe a.cmx b.cmx
$ ls
a.cmi a.cmx a.ml a.o b.cmi b.cmx b.exe b.ml b.o

```
