Unbound module when compiling in VScode

I’m trying to use VScode with OCaml and have completed the vscode OCaml setup and the ./ocamlinit file however when I run ocamlc -o test test.ml I get back the error “Unound module Base”.
I can run “open Base;;” in the ocaml terminal but i cannot compile it from VScode. any help is appreciated.

VSCode is a red herring. You actually need to set up a project build, using the dune build system. Dune will take care of linking in the library dependencies for you. This is a good getting started guide: Getting Started with OCaml in 2021 · Perpetually Curious Blog

Once your dune build is working, VSCode error reporting should stabilize. Just restart or reload the editor to make sure.

1 Like