[erlang-questions] Ignore duplicate difinitions in header files

Richard Carlsson <>
Fri Jun 1 11:21:13 CEST 2007


Eranga Udesh wrote:
> Is there a way to ignore duplicate object definitions (eg. record, 
> define, etc) in different included files (.hrl)? For example, if one 
> definition found in a previous included .hrl file, use that, but ignore 
> any later duplicates find. This is required to prevent when multiple 
> .hrl files define the same variable the exactly the same, but 
> compilation exists with errors.

-ifndef(foo).
-define(foo, ...).
-endif.

(Assuming you have control over at least one of the source .hrl files.)

     /Richard




More information about the erlang-questions mailing list