erlang精要(23)-erl(2)

(base) [myhaspl@localhost erl]$ cd learnerl
(base) [myhaspl@localhost learnerl]$ ls
learnerl.beam  learnerl.erl  learnerl.hrl
(base) [myhaspl@localhost learnerl]$ rm *.beam
(base) [myhaspl@localhost learnerl]$ ls
learnerl.erl  learnerl.hrl
(base) [myhaspl@localhost learnerl]$ erlc learnerl.erl
(base) [myhaspl@localhost learnerl]$ ls
learnerl.beam  learnerl.erl  learnerl.hrl

使用erlc在终端编译erl代码,如上所示
下面是更多功能:
1、cd:进入目录
2、compile:file:编译
3、debug_info:编译选项,打开调试信息
4、export_all:编译选项,导出所有函数

3> cd("I:/learn/erl/").
i:/learn/erl
ok
4> c("learnerl.erl").
{ok,learnerl}
5> learnerl:count_char("dsdafewr32adsfaf").
#{50 => 1,51 => 1,97 => 3,100 => 3,101 => 1,102 => 3,114 => 1,
  115 => 2,119 => 1}
6> compile:file("learnerl.erl").
{ok,learnerl}
7> learnerl:count_char("dsdafewr32adsfaf").
#{50 => 1,51 => 1,97 => 3,100 => 3,101 => 1,102 => 3,114 => 1,
  115 => 2,119 => 1}
8> compile:file("learnerl.erl",[debug_info,export_all]).
{ok,learnerl}

5、outdir:指定编译后文件输出目录
6、hipe:生成本地代码

14> compile:file("learnerl.erl",[debug_info,export_all,{outdir,"i:/learn/"},hipe]).
{ok,learnerl}
15> learnerl:count_char("dsdafewr32adsfaf").                                    
#{50 => 1,51 => 1,97 => 3,100 => 3,101 => 1,102 => 3,114 => 1,
  115 => 2,119 => 1}
16> 
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 鲸 设计师:meimeiellie 返回首页