Executables must be specified inside
(executable ...) stanzas in a
dune file in the same directory as the executable.
src/scanner-adhoc/dune, you define the executable
scanner-test, but no executable for the
scanner module, hence the error message. You could add a new stanza for
scanner, but then Dune will require you to specify which modules belong to which executables (which is a problem for your case, since
scanner-test requires code supplied by
If you want to define some common code that’s used by two executables, you should use a single library stanza and two executable stanzas that depend on it:
This will have the advantage of keeping your library code (
scanner) distinct from the run-time side-effects that it currently defines. (If you didn’t do this, any code that depends on
Scanner (in this case,
scanner-test) would end up inheriting its run-time side-effects too.) Even better, you could split the
scanner-adhoc folder into
test/ (each with their own
dune file), and then you wouldn’t need to tell Dune which modules correspond to which build artefacts.