My test project is structured this way:
./Emakefile:
{"source/*", [debug_info, {outdir, "binary"}]}.
./source/test.erl:
-module(test).
-behaviour(test_behaviour).
./source/test_behaviour.erl:
-module(test_behaviour).
-export([behaviour_info/1]).
behaviour_info(callbacks) -> [];
behaviour_info(_) -> undefined.
When I use the command erl -make in the project directory (.), I get the following output:
Recompile: source/test_behaviour Recompile: source/test source/test.erl:2: Warning: behaviour test_behaviour undefined
Why does erl print this warning ? It compiled test_behaviour.erl before test.erl, so I guess it should be able to find test_behaviour.beam in the binary folder.
Behaviors are resolved at the compile time. Hence the Erlang compiler should find the behavior beam file and call the behavior module's behaviour_info/1 function.
Here test_behaviour.beam is not in the code path of the compiler. You can run by calling
erl -pa ebin -make
This solved the problem for me. I tried specifying in Emakefile but with no luck. Could not find the documentation also. Also found that oder of -pa ebin has to be before -make (not sure why though).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With