[erlang-questions] macro in include definition - can't

Ahmed Omar <>
Wed May 11 16:52:44 CEST 2011


But why are you doing it that way?
Why not just in pcount.hrl write
include("/some/path/some.hrl").

and in you pcount.erl just
-include("pcount.hrl").



On Wed, May 11, 2011 at 4:12 PM, Wes James <> wrote:

> 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 <> 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 <> 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
> >> 
> >> http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
> >
> > --
> > Best Regards,
> > - Ahmed Omar
> > http://nl.linkedin.com/in/adiaa
> > Follow me on twitter
> > @spawn_think
> >
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110511/3f09bc4e/attachment.html>


More information about the erlang-questions mailing list