When loading OCaml, I receive this message when loading ocaml at the terminal:
ocaml
OCaml version 4.07.1
Unknown directive `require'.
What is the problem exactly?
I had previously modified my ocamlinit file, because I had some problems. It now contains:
(* ## added by OPAM user-setup for ocamltop / base ## 3ec62baf6f9c219ae06d9814069da862 ## you can edit, but keep this line *)
(* Added by OPAM. *)
let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
with Not_found -> ()
;;
#require "yojson";;
#use "topfind";;
#camlp4o
#thread;;
Topfind.don't_load ["compiler-libs.toplevel"];;
#require "core.top";;
#require "core.syntax";;
(* ## end of OPAM user-setup addition for ocamltop / base ## keep this line *)
Edit:
I looked at this question before ocaml command line cannot find “topfind”, however I did not find it helpful, since nowhere in the answers was it specified that you need to run eval $(opam config env)
every time before opening ocaml, as someone below has informed me. So I think this person's clarification is useful to have on this site for other people.