[erlang-questions] -include with define macro
Mon Sep 21 17:36:18 CEST 2015
On Mon, Sep 21, 2015 at 1:56 PM, zxq9 <zxq9@REDACTED> wrote:
> On 2015年9月21日 月曜日 14:26:35 Martin Koroudjiev wrote:
> > -ifdef(CONTAINING_APP_INCLUDE).
> > -include(?CONTAINING_APP_INCLUDE).
> > -endif.
> > and to compile the source files as:
> > erlc -Werror -Wall -DCONTAINING_APP_INCLUDE="\"<path>/<file>.hrl\""
> > <module>.erl
> > but I get the following error:
> > badly formed 'include'
> I think includes run before macros, so your include is trying to include a
> very odd-looking thing that starts with a question-mark instead of a
Not quite. The -include and -include_lib directives require that the thing
between the parentheses is a string literal, so the tokens '?'
are not even subject to macro expansion in this case. (This could probably
be easily fixed, if it is important to anyone.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions