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 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员