I'm following the tutorial on the nitrogen project page: starter tutorial here
and when I point my browser to localhost:8000
it does not work. I suspect it is something to do with this following the command:
make rel_inets;
/home/david/programming/erlang/nitrogen/nitrogen/rel/nitrogen/lib/erlware_commons/src/ec_cmd_log.erl:160:5: ambiguous call of overridden auto-imported BIF error/3
**-** use erlang:error/3 or "-compile({no_auto_import,[error/3]})." to resolve name clash Compiling /home/david/programming/erlang/nitrogen/nitrogen/rel/nitrogen/lib/erlware_commons/src/ec_cmd_log.erl failed: ERROR: compile failed while processing /home/david/programming/erlang/nitrogen/nitrogen/rel/nitrogen/lib/erlware_commons: rebar_abort make[4]: *** [Makefile:12: compile] Error 1
Does anyone have any idea of what is going wrong? Looks to be some clash between function names. I installed the latest erlang 24.0.1 and I still got the same behaviour. Thanks
1条答案
按热度按时间yhxst69z1#
Does anyone have any idea of what is going wrong?
Here is an example...Erlang defines a function
error/2
, known as a BIF or Built In Function, which can be called like this:In the shell:
Now, look what happens if you define a function also named
error/2
in your module:In the shell:
The warning tells you that if you really meant to call erlang's
error/2
, then you should preceed the function name with the module name in which the function is defined, namely theerlang
module:...or, if you want to call your version of
error/2
, then put the module directive:at the top of your module:
Note that the problem in the code is only a
warning
, and when I run my program as originally written, erlang calls the version oferror/2
defined in my module--not the one in theerlang
module.The strange thing is: there is no
error/3
defined in the erlang module.