w554292246 2013-11-14 08:55 采纳率: 0%
浏览 2949

erlang 服务器端编程 错误提示 variable 'State' is unbound

-module(gen_server_template).
%% gen_server_template

-behaviour(gen_server).
-export([start_link/0]).
%% gen_server callbacks

-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).

start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).

init([]) -> {ok, State}.

handle_call(_Request, _From, State) -> {reply, Reply, State}.
handle_cast(_Msg, State) -> {noreply, State}.
handle_info(_Info, State) -> {noreply, State}.
terminate(_Reason, _State) -> ok.
code_change(_OldVsn, State, Extra) -> {ok, State}.

以上是erlang otp编程,的服务器端,我是照着书上敲的代码,刚接触erlang没几天,我编译时,提示我以下错误,求各位大神看看我该怎么修改???问题原因是什么???

gen_server_template.erl:11: undefined macro 'SERVER'
gen_server_template.erl:5: function start_link/0 undefined
gen_server_template.erl:13: variable 'State' is unbound
gen_server_template.erl:15: variable 'Reply' is unbound
gen_server_template.erl:19: Warning: variable 'Extra' is unused
error

  • 写回答

3条回答

  • w554292246 2013-11-14 08:58
    关注

    在线等啊。学习中。。。。

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?