简体   繁体   English

在 OCaml 顶层使用 Str 模块?

[英]Using Str module in OCaml top level?

I tried two commands to load Str Module in OCaml top level.我尝试了两个命令在 OCaml 顶层加载 Str 模块。 The first command gives me the error "Cannot find file Str.cmo".第一个命令给了我错误“找不到文件 Str.cmo”。 I then tried to use the file i was using in top level with the second command.然后我尝试使用我在顶层使用的文件和第二个命令。 With that command i got "Reference to undefined global Str".使用该命令,我得到了“对未定义全局 Str 的引用”。

#load "Str.cmo";;

#use "my_file.ml";;

What do i need to do to successfully load Str module in OCaml top level.我需要做什么才能在 OCaml 顶层成功加载 Str 模块。

# #use "topfind";;
# #require "str";;

Modules are "archives", so they are .cma files, not .cmo :模块是“档案”,所以它们是.cma文件,而不是.cmo

# #load "str.cma";;
# Str.regexp;;
- : string -> Str.regexp = <fun>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM