[erlang-questions] Newbie: Compile error with records

Alex Hammel ahammel87@REDACTED
Tue Apr 29 17:20:40 CEST 2014


I don't think it's legal to construct record instances at the top level.
(Even if it was, how would you refer to them?)

You'll need to wrap the record construction in a function or a macro.


On Tue, Apr 29, 2014 at 7:48 AM, Schneider <schneider@REDACTED> wrote:

> Hi list,
>
>
>
> I am trying to create a bunch of records in an include file, but I just
> can’t get it to work.
>
> What is wrong about this hrl file
>
>
>
> -record(data_ids, {data_id, mnem, descr}).
>
>
>
> #data_ids{data_id=1, mnem="ONE", descr="Number one."}.
>
>
>
> The compiler gives the error:
>
> src/data_ids.hrl:5: syntax error before: '#'
>
>
>
> Thanks
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140429/6ad0322e/attachment.htm>


More information about the erlang-questions mailing list