[erlang-questions] -include with define macro

Martin Koroudjiev mrtndimitrov@REDACTED
Mon Sep 21 13:26:35 CEST 2015


I am working on an app that will often be included into bigger
applications. In an .hrl file, my app defines some debug macros. But I
would like to allow the enclosing app to provide a better, more specific
to its needs, implementation of these macros. So in the .hrl file I do:

-define(DEBUG(Format, Args),
    io:format("DEBUG: ~p ~p: "++Format, [?MODULE, ?LINE | Args])).

In all my source files, I include the .hrl file. But how should I
include the enclosing app .hrl file where the DEBUG macro is defined? I
tried this:


and to compile the source files as:

erlc -Werror -Wall -DCONTAINING_APP_INCLUDE="\"<path>/<file>.hrl\""

but I get the following error:

badly formed 'include'

Thanks in advance for taking the time to look at this.


More information about the erlang-questions mailing list