Intellij idea Erlang崩溃转储正在写入:erl_Crash.Dump…完成
所以我刚开始学习一些基本的Erlang。我正在研究IntelliJ Idea。我编写了一个基本函数来添加两个数字:Intellij idea Erlang崩溃转储正在写入:erl_Crash.Dump…完成,intellij-idea,erlang,Intellij Idea,Erlang,所以我刚开始学习一些基本的Erlang。我正在研究IntelliJ Idea。我编写了一个基本函数来添加两个数字: -module(easy). -author("var"). %% API -export([add/2]). add(X, Y) -> X + Y. 但是,当我运行它时,我得到以下错误: {"init terminating in do_boot",{{badmatch,{error,{1,erl_parse,["syntax error before: ","'
-module(easy).
-author("var").
%% API
-export([add/2]).
add(X, Y) ->
X + Y.
但是,当我运行它时,我得到以下错误:
{"init terminating in do_boot",{{badmatch,{error,{1,erl_parse,["syntax error before: ","','"]}}},[{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()
我似乎不明白为什么会这样。这与Idea的运行配置有关吗?不确定如何执行代码。试着按照这些步骤来做 创建包含源代码的文件,在本例中为
easy.erl
,您已经拥有:
[g@somecomp:~/test]$ cat easy.erl
-module(easy).
-author("var").
%% API
-export([add/2]).
add(X, Y) ->
X + Y.
现在编译模块:
[g@somecomp:~/test]$ erlc easy.erl
启动Erlang并从shell加载它:
[g@somecomp:~/test]$ erl
Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.2.1 (abort with ^G)
1> l(easy).
{module,easy}
在shell中执行函数并关闭Erlang:
2> easy:add(1,2).
3
3> q().
ok
4> [g@somecomp:~/test]$
或者,您可以直接从shell执行它(bash
,csh
),但在这种情况下,您必须显式打印返回值:
[g@somecomp:~/test]$ erlc easy.erl
[g@somecomp:~/test]$ erl -noshell -eval 'io:format("~p~n", [easy:add(1,2)])' -s init stop
3
[g@somecomp:~/test]$
我刚刚在本地测试了代码,效果非常好。问题必须与环境/配置相关。很抱歉,无法进一步帮助。是的,我认为我的配置/环境存在一些问题。试着弄明白这一点。谢谢你!