开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜