Erlang hello world problem?
I can't understand why this doesn't work:
-mo开发者_开发问答dule(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").
(hello_world@PC)8> hello:hello_world().
** exception error: undefined function hello:hello_world/0
(hello_world@PC)9>
Have you compiled your source code? Type c(hello).
in Eshell (assuming that hello.erl
is the name of the source file) before calling the function.
The way to fix that:
Go to:
Run configurations
--Erlang
Select tab:
--Environment
then
--Select
check
-- Path
Apply and run.
Now you'll be good to go.
精彩评论