【问题标题】:Erlang module compilingErlang 模块编译
【发布时间】:2015-12-13 06:53:08
【问题描述】:

我开始学习Erlang,读完第一章后编译模块时出现奇怪的错误。

所以当我尝试编译 demo.erl 时

-module(demo).
-author("alex").

-export([double/1]).

double(Value) ->
   Value * 2.

所以我尝试编译它

1> m(demo).

得到了

** exception error: undefined function demo:module_info/0

编译的唯一方法是

make:files(filelib:wildcard("demo.erl")).

我得到了 demo.beam,现在即使在删除它 m(demo) 之后也是如此。开始工作。

谁能向我解释一下编译器的行为?

【问题讨论】:

    标签: erlang


    【解决方案1】:

    要从 Erlang shell 编译模块,请使用 c 命令:

    1> c(demo).
    {ok,demo}
    

    shell m 命令用于检索有关已编译模块的信息:

    2> m(demo).
    Module: demo
    MD5: 422cee9099e136c6dec13dd200927c63
    Compiled: December 12 2015, 22:51
    Object file: /tmp/demo.beam
    Compiler options:  []
    Exports:
             double/1
             module_info/0
             module_info/1
    ok
    

    【讨论】:

      猜你喜欢
      • 2013-04-08
      • 2018-06-14
      • 2015-12-20
      • 2019-01-27
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 1970-01-01
      相关资源
      最近更新 更多