Skip to main content

W0015 - Dependent Header

Error​

/my_app/include/my_header.hrl
-define(MY_MACRO, #my_record.my_field).
%% ^^^^^^^^^^ warning: Record 'my_record' not defined in this context
-define(IS_VALID(Value), ?VALIDATE(Value)).
%% ^^^^^^^^^ warning: Macro 'VALIDATE/1' not defined in this context

Explanation​

The message is indicating that the given header file is not "independent", meaning that it contains a reference to an entity (the my_record record and the VALIDATE macro in this case) which is neither defined in the same file or included. Since header files are processed lazily, the Erlang compiler cannot detect this situation but ELP can. Such a header forces each of its includers to include the header defining the missing entity first.

To fix the error, include the header file where the my_record record and the VALIDATE macro are defined.