[erlang-questions] bug in escript and a question

zabrane Mikael <>
Tue Oct 5 10:38:25 CEST 2010


Hi Joe,

The "-include(...)" works fine like this:

!/usr/bin/env escript
%% -*- erlang -*-
%%! -pz ../mycode ebin

-include_lib("mycode/include/my.hrl").

Regards
Zabrane

2010/10/5 Joe Armstrong <>:
> This escript fails
>
>
>  +-------------------------------------
>    -record(b,{this=that}).
>
>    main(_) ->
>       io:format("B=~p~n",[#b{}]),
>       halt(1).
>  +-----------------------------------
>
> The code is between the lines marked +------
>
> This is what happens
>
> $ escript b 12
> b:3: record b undefined
> escript: There were compilation errors.
>
> If you add a single blank or comment before the record declartion then it works
>
>  +-------------------------------------
>   %% comment
>    -record(b,{this=that}).
>
>    main(_) ->
>       io:format("B=~p~n",[#b{}]),
>       halt(1).
>  +-----------------------------------
> $ escript b 12
> B={b,that}
> :~/work/c_compiler/bic_current/src$
>
> Now it works
>
> Also -include(..) just doesn't work but -include_lib(...) does.
> I cannot think why this should be so - is there any good reason for this?
> I can't think of one.
>
> Cheers
>
> /Joe
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>



-- 
Regards
Zabrane


More information about the erlang-questions mailing list