找不到OCaml Mutex模块 [英] OCaml Mutex module cannot be found

查看:67
本文介绍了找不到OCaml Mutex模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Mutex模块,例如Mutex.create(),但是编译器说未绑定模块Mutex.是否需要一些特殊的名称空间?谢谢

I tried to use Mutex module, such as Mutex.create(), but compiler says Unbound module Mutex. Does it require some special namespace? Thanks

推荐答案

对于顶级:

ocaml -I +threads

# #load "unix.cma";;
# #load "threads.cma";;
# Mutex.create ();;
- : Mutex.t = <abstr>

对于 ocamlc :

ocamlc -thread unix.cma threads.cma src.ml

对于 ocamlopt :

ocamlopt -thread unix.cmxa threads.cmxa src.ml

对于 findlib :

ocamlfind ocamlc -thread -package threads -linkpkg src.ml

这篇关于找不到OCaml Mutex模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆