Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top