문제

When I try to compile an OTP supervisor module that starts like this:

-module(gridz_sup).

-behaviour(supervisor).

-export([start_link/0, start_child/2]).

-define(SERVER, ?MODULE).

yada, yada...

I get the following error:

gridz_sup.erl:9: Warning: undefined callback function init/1 (behaviour 'supervisor').

Can some kind soul point out the error of my ways?

Many thanks,

LRP

도움이 되었습니까?

해결책

When implementing a behaviour call back module there is a number of mandatory call back functions that has to be defined and exported. If not you will get the warning as you saw. For the supervisor behaviour there is only one mandatory call back function init which takes one argument.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top