我对Erlang非常陌生,我正在尝试编译我的第一个Erlang模块,但得到一个错误,即不存在这样的文件,尽管它确实存在。
任何关于为什么我的erl.exe不能编译useless.erl的建议都是非常感谢的。
首先要感谢大家!
erl.exe命令提示符(注意模块实际上包含useless.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).发布于 2013-04-16 05:56:13
对于这种形式,您需要在您试图编译的模块所在的同一目录中执行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().
hellohttps://stackoverflow.com/questions/16024304
复制相似问题