[erlang-questions] macro in include definition - can't
Wes James
comptekki@REDACTED
Wed May 11 16:12:33 CEST 2011
oops, clicked send to soon:
I have pcount.erl and pcount.hrl
here is part of pcount.hrl
-define(SOME, "/some/path/some.hrl").
in pcount.erl
-include("pcount.hrl").
-include(?SOME).
erlc pcount.erl
./pcount.erl:10: badly formed 'include'
with
-include("?SOME").
I get:
erlc pcount.erl
./pcount.erl:10: badly formed 'include'
So there doesn't seem to be a way of doing nested macros.
thx,
-wes
On Tue, May 10, 2011 at 4:33 PM, Ahmed Omar <spawn.think@REDACTED> wrote:
> I'm not sure i understand what u r trying to do exactly. but are u trying to
> do
> -define(FILE, "somepath").
> in some.hrl?
> cause ?FILE is a predefined macro that is expanded to the name of the
> current module, you can't redefine it.
>
> On Tue, May 10, 2011 at 11:36 PM, Wes James <comptekki@REDACTED> wrote:
>>
>> I was trying to do something like this:
>>
>> -include("some.hrl").
>> -include(?FILE).
>>
>> Where FILE is defined in some.hrl, but found that can't be done. I
>> was trying to define a path to a hrl file without having it show in
>> the actual file on github. I guess the way to do this is with an
>> environment variable, if I'm worried about it.
>>
>> I found info on macros in "The Preprocessor" page on erlang.org
>>
>> http://www.erlang.org/doc/reference_manual/macros.html
>>
>> -wes
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> --
> Best Regards,
> - Ahmed Omar
> http://nl.linkedin.com/in/adiaa
> Follow me on twitter
> @spawn_think
>
More information about the erlang-questions
mailing list