[erlang-questions] Ignore duplicate difinitions in header files

Eranga Udesh <>
Fri Jun 1 14:30:57 CEST 2007


Thanks, but sorry I couldn't mention "something other than using -ifndef".
Something like using a compiler argument, etc? Some sources are generated by
ASN.1 or Yacc, etc. in compile time, I try to void editing them manually.

Thanks,
- Eranga



-----Original Message-----
From: Richard Carlsson [mailto:] 
Sent: Friday, June 01, 2007 2:51 PM
To: Eranga Udesh
Cc: 
Subject: Re: [erlang-questions] Ignore duplicate difinitions in header files

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