Emakefile - custom behavior undefined

My test project is structured like this:

./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 erl -make in the project directory ( . ), I get the following output:

  Recompile: source / test_behaviour
 Recompile: source / test
 source / test.erl: 2: Warning: behavior test_behavior undefined 

Why is erl printing this warning? It compiled test_behaviour.erl to test.erl , so I assume that it should find test_behaviour.beam in the binary folder.

+4
source share
1 answer

Behavior is allowed at compile time. Therefore, the Erlang compiler must find the behavior pool file and call the behavior module function behaviour_info/1 .

Here test_behaviour.beam is not in the code of the compiler code. You can run by calling

 erl -pa ebin -make 

This solved the problem for me. I tried to point to Emakefile, but no luck. Could not find documentation. Also found that any of -p-ebin should be before -make (not sure why).

+4
source

All Articles