1
votes

I just installed opam and installed the uint package. However when I attempt to do something like this

File : Hello.ml
let ash(mystring) = (
    let basis =   uint64.of_string("0xcbf29ce484221325") in
    Printf.printf "Function Finished" ;
);;

ash("Hello");;

I get the error

Error: Unbound value uint64

Any suggestions on what I could be missing ? I am new to OCaml and opam

I used the following statement to compile the code in my OSX terminal

ocaml Hello.ml 
1
Is this in the top level, is it compiled, what flags did you use, how did you compile it? You got to give us more than just it doesn't work. - Edgar Aroutiounian
Ill add my entire code here. Sorry I was not aware of those details - James Franco
You forgot to capitalize uint64 in Uint64.of_string. Modules are always capitalized. - Anthony Scemama

1 Answers

1
votes

Few issues, you don't need the () around arguments unless you intend them to be a tuple of values (Perhaps a topic you'll learn later down the road)

Plain ocaml is just like an interpreter, it doesn't know where installed code is (Perhaps you're used to like python where the interpreter has a few places that it looks on its own first)

let ash mystring =
  let basis = Uint64.of_string "0xcbf29ce484221325" in
  Printf.printf "Function Finished"

let () =
  ash "Hello"

Assuming that is called hello.ml, you can compile it with

ocamlfind ocamlc -package uint -linkpkg hello.ml -o Test

(This is using the ocamfind wrapper and it calls ocamlc for you and tells it to use the uint package and link it for the final executable called Test)

and then run it with

./Test