[erlang-questions] Newbie: Compile error with records

Loïc Hoguin essen@REDACTED
Tue Apr 29 17:19:27 CEST 2014


What are you trying to do? You can't create records outside a function. 
This would work on the other hand:

f() -> #data_ids{data_id=1, mnem="ONE", descr="Number one."}.

On 04/29/2014 04:48 PM, Schneider 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
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list