i installed it but it says
Cannot find file websocket.
What did you install ? What are you trying to achieve ? What’s is the code you’re trying to run ? How are you running your code ?
i created a project by using
dune init project myproject
now i am stuck in :
the installtion of the websocket library
There are plenty of websocket related libraries in OCaml. Which one are you trying to install ? What did you try ?
You should do something like: opam install websocket
.
i did
opam install websocket.2.15
OK, so what error are you getting, what are you precisely trying to do that is not working ?
Unknown directive `require'.
How are you getting this error ? What is the code you’re running ?
i am doing
#require websocket
the code i am running is this
let name = match "hello" with
| "hello world" -> Printf.printf "true : hello world"
| _ -> Printf.printf "false : not found"
Where do you write this code ? In a .ml
file ? How are you compiling ?
yes in .ml file and i am using ocaml to compile
Which exact command are you using to compile ?
ocamlc codes.ml
tstststststs
#require
can be used only in the toplevel/REPL, that is when using the ocaml
or utop
command and then entering some expressions.
When compiling a file, you should do something like:
ocamlfind ocamlc -linkpkg -package websocket codes.ml
Or learn how to use a proper build system such as dune
.
#use "topfind";;
#require "websocket";;
let name = match "hello" with
| "hello world" -> Printf.printf "true : hello world"
| _ -> Printf.printf "false : not found"
it is still not working and this is what i get
Cannot load required shared library dllbigstringaf_stubs.
Reason: dllbigstringaf_stubs.dll: The specified module could not be found.
.
codes.ml
:
(* do not put any #require or #use here ! *)
let () =
print_endline Websocket.websocket_uuid
Then compiling and running the code with:
$ ocamlfind ocamlc -linkpkg -package websocket codes.ml
$ ./a.out
258EAFA5-E914-47DA-95CA-C5AB0DC85B11
What are you getting when doing exactly this ?
#use "topfind";;
#require "websocket";;
let () =
print_endline Websocket.websocket_uuid
let name = match "hello" with
| "hello world" -> Printf.printf "true : hello world"
| _ -> Printf.printf "false : not found"
Cannot load required shared library dllbigstringaf_stubs.
Reason: dllbigstringaf_stubs.dll: The specified module could not be found.
.
Please, read what I wrote…
(* do not put any #require or #use here ! *)
that is a comment is not it ?