[erlang-questions] -include with define macro

Martin Koroudjiev mrtndimitrov@REDACTED
Mon Sep 21 15:46:34 CEST 2015


Thanks for the info. I will organize the code as you suggested.

Regards,
Martin

On 9/21/2015 2:56 PM, zxq9 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 filename.
>
> Usually things like debug (or other selective behavior definitions) expand to reference a module based on the debug level (or whatever). So ?DEBUG might look like
>
> ?DEBUG:report(Foo)
>
> in code and one time expand to: `my_logger:report(Foo)` or `my_full_blown_debugger:reort(Foo)` or `my_do_nothing_module:report(Foo)`. In the last case the function might be optimized out entirely if it really does nothing.
>
> -Craig
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list