这是我的进出口商品
-import(calling, [create_receiver_process/1, create_senders_process/1]).
-export([main/1, read_file/1, merge_method/1, merge_method/2, master_process/1, print_data/1]).
这是我怀疑的代码,是导致错误
{gotintro, Sender, Receiver, Time} ->
io:format("~p received intro message from ~p [~p]~n", [Receiver, Sender, Time]),
master_process(RPs);
{gotreply, Sender, Receiver, Time} ->
io:format("~p received reply message from ~p [~p]~n", [ Sender,Receiver, Time]),
master_process(RPs)
这就是错误,我得到了
=ERROR REPORT==== 14-Jun-2020::20:58:23.841027 ===
Error in process <0.88.0> with exit value:
{undef,[{test,base_receiver_method,[],[]}]}
=ERROR REPORT==== 14-Jun-2020::20:58:23.848795 ===
Error in process <0.100.0> with exit value:
{undef,[{test,send_message,[john,joe],[]}]}
下面是base_receiver_method
base_receiver_method() ->
receive
{intro , Sender, Receiver, Time} ->
io:format("Message Intro ~p ~p~n", [Sender, Receiver]),
Name = string:concat(lists:flatten(io_lib:format("~p", [Sender])), "sender"),
N = list_to_atom(Name),
N ! {reply, Receiver, Sender, Time},
timer:sleep(round(rand:uniform() * 100)),
master ! {gotintro, Receiver, Sender, Time},
base_receiver_method();
{reply , Sender, Receiver, Time} ->
io:format("Message Reply ~p ~p~n", [Sender, Receiver]),
timer:sleep(round(rand:uniform() * 100)),
master ! {gotreply, Receiver,Sender, Time},
base_receiver_method()
after 1000 ->
exit("Time Up")
end.
下面是send_message:
send_message(S, R) ->
Name = string:concat(lists:flatten(io_lib:format("~p", [R])), "receiver"),
N = list_to_atom(Name),
{_, _, Time} = erlang:now(),
N ! {intro, S, R, Time}.
1条答案
按热度按时间uqzxnwby1#
尝试导出或导入您尝试调用的函数。错误消息意味着您尝试调用的函数未定义,看起来您需要更新
import
并放入base_receiver_method/0, send_message/2
,但在此之前,请尝试导出您尝试导入的模块中的函数。