Ocaml commands and directories

Let s say we have two files a.ml and b.ml in a “src” directory. With stupid code inside just for the test.

let a = "filea"
open A

let b =  "fileb"

Then I compile the files with these commands

ocamlc -c src/a.ml src/b.ml

I got Error: Unbound module A

Of course it works if I enter in src directory and remove “src” in commands.

Dune is able to put files in complicated directory structure so I guess I can do that with the simple commands, but I don’t know how.

ocamlc -c src/a.ml src/b.ml compiles into src but search in .

You can type ocamlc -c src/a.ml src/b.ml -I src.

I guess dune compiles with a -o option and select the destination file (in _build), then a -I is used too.

I missed that -I option ! Thank you.