Please tell me how to use Core.

Asked 2 years ago, Updated 2 years ago, 123 views

Install core in opam as follows on osx.

opam install core

Write the following program ex01.ml and

open Core.Std

let_=
  let list = [1;2;3] in
  letrc=List.fold_leftlist~init:0~f:(fun accx->
    acc+x
  ) in
 Printf.printf "%d\n"rc

ex01.ml

Compiled with the following command:

$ocamlfindocamlopt-package core ex01.ml

The following error appears:

ocamlfind: Error from package `threads': Missing-thread or-vmthread switch

It is said that the threads package switch is not working, but I am wondering what threads are.

ocamlbuild-use-ocamlfind-package core-tag thread ex01.native

If I wrote it like this, it worked, but I still don't know when I used omake.
It would be great if you could understand how to write using ocamlfind.

ocaml

2022-09-30 19:40

1 Answers

OMakefile has also been self-resolved. I should have added the -thread option.

.PHONY:all clean
USE_OCAMLFIND=true
FILES[] = ex01
OCAMLPACKS[]=
  core
OCAMLCFLAGS+=-thread
OCAMLOPTFLAGS+=-thread

.DEFAULT:$(OCamlProgram ex01,$(FILES))
US>clean:
  rm-f$ (filter-proper-target$(ls R,.))


2022-09-30 19:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.