You need to specify that you want to use the ANSITerminal library in your dune file, see for example here (substitute lwt.unix by ANSITerminal).
The other modules you mention are part of the standard library against which your program is linked by default so there’s no need to specify anything to use them.
You will need to put the module in your dune-project file as well at the root of your workspace as well if you haven’t already.
That dune-project file should should have a stanza similar to the one below, and you will need to include whatever libraries you declare in the (depends ...) clause.
(package
(name placeholder)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune raylib)
(tags
(topics "to describe" your project)))
Edit: never mind. @nojb corrected me on this misconception below.
You need to make sure that the ANSITerminal library is installed: opam install ANSITerminal.
Actually, the (package) stanza is not used in any way for compilation; it is only relevant when you want to publish your package, so it is not relevant here.
But there’s an idiom: opam install . --deps-only: it makes sense to put the library in the package dependencies and not use opam install X for specific dependencies X, to make one’s life easier when changing switches (and ultimately when making the project public).
This had been done already though, as stated in my initial post.
PS H:\OCaml\Bataille> opam info ANSITerminal
<><> ANSITerminal: information on all versions ><><><><><><><><><><><><><><><><>
name ANSITerminal
all-installed-versions 0.8.5 [playground]
all-versions 0.6 0.6.2 0.6.3 0.6.4 0.6.5 0.7 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5
<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version 0.8.5
repository fdopen-mingw-1.2.0-4.14.0
pin https://github.com/Chris00/ANSITerminal/releases/download/0.8.5/ANSITerminal-0.8.5.tbz
url.src "https://github.com/Chris00/ANSITerminal/releases/download/0.8.5/ANSITerminal-0.8.5.tbz"
url.checksum "sha256=ab73b218b6a30267d2bbc43312dcf313981b8b0bec555d92b06b87664b2dd30e"
"sha512=8ddd766c007bf66d6a6d1ce0f68ad55e18e82f439fdec6c0387f18f6a5e8c87bb2d7b595cbdab5acf9a5cf76efa73b8e8921481a5028774dcd9d2d9fe544603e"
homepage "https://github.com/Chris00/ANSITerminal"
doc "https://Chris00.github.io/ANSITerminal/doc"
bug-reports "https://github.com/Chris00/ANSITerminal/issues"
dev-repo "git+https://github.com/Chris00/ANSITerminal.git"
authors "Christophe Troestler" "Vincent Hugot"
maintainer "Christophe Troestler <Christophe.Troestler@umons.ac.be>"
license "LGPL-3.0-or-later WITH OCaml-LGPL-linking-exception"
tags "terminal"
depends "ocaml" {os != "win32" | >= "4.04"}
"dune" {>= "2.0"}
"base-bytes"
"base-unix"
synopsis Basic control of ANSI compliant terminals and the windows shell
description ANSITerminal is a module allowing to use the colors and cursor
movements on ANSI terminals. It also works on the windows shell (but
this part is currently work in progress).
In that case, have you checked if your environment is in sync with your current OPAM switch? OPAM will tell you if you do opam switch. If it is not, Installing OCaml · OCaml Documentation suggests doing