我对Erlang非常陌生,我试图编译我的第一个Erlang模块,并且得到一个错误,没有这样的文件存在,尽管它实际上存在。
关于为什么我erl.exe无法编译useless.erl
的任何建议都非常感谢。
提前感谢!
erl.exe命令提示符(注意模块实际上包含无用的。erl)
1> filename:absname("C:/Users/modules").
"C:/Users/modules"
2> c(useless).
useless.erl:none: no such file or directory
(useless.erl)-module(useless).
-export([add/2, hello/0, greet_and_add_two/1]).
add(A,B) ->
A + B.
%% Shows greetings.
%% io:format/1 is the standard function used to output text.
hello() ->
io:format("Hello, world!~n").
greet_and_add_two(X) ->
hello(),
add(X,2).
使用这种形式,您需要在与您试图编译的模块相同的目录下执行erl
。使用c
功能时,可以指定文件路径。这将在当前目录中创建一个.beam
文件:
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.10.1 (abort with ^G)
1> c("stackoverflow/passfun.erl").
{ok,passfun}
2> passfun:some_func().
hello