现在的位置: 首页 > 综合 > 正文

Erlang基础 – 模块的编译和函数的调用

2019年06月20日 ⁄ 综合 ⁄ 共 298字 ⁄ 字号 评论关闭

在erlang shell下操作:

$ erl
Erlang R16B03 (erts-5.10.4) [source] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
% 编译模块,无须指定文件扩展名
1> c(helloworld).
{ok,helloworld}

% 调用指定模块的函数
2> helloworld:pie().
3.14
3> 

非erlang shell下操作,如:

erlc helloworld.erl

erlc -o ./ebin helloworld.erl

其中-o 是指定输出目录,用于放置.beam文件。

抱歉!评论已关闭.