Karel
Karel

Reputation: 13

Beginners Erlang - hello_world

I have a similar problem to the this:

-module(hello).
-export([hello_world/0]).

hello_world() -> io:fwrite("hello, world\n").

Result:

(hello_world@PC)8> hello:hello_world().
** exception error: undefined function hello:hello_world/0
(hello_world@PC)9> 

but the instructions

"The way to fix that:

Go to: Run configurations
--Erlang
Select tab:
--Environment
then
--Select
check
-- Path
Apply and run."

do not solve my problem.

Is it perhaps my software, because getting hold of some of it was quite troublesome. I have Erlang 5.10.1 R16B with Erlide plug-in (version 0.9.0.201010061109) for Eclipse 4.2.2?

Any help will be appreciated!

Upvotes: 1

Views: 399

Answers (2)

0xAX
0xAX

Reputation: 21837

Did you compile your hello.erl?

c(hello).

After that you get a hello.beam file, and then you can try to execute:

hello:hello_world().

In the directory with the hello.beam file.

Upvotes: 3

Vlad Dumitrescu
Vlad Dumitrescu

Reputation: 941

Try this: in your editor window, right click and choose Run As->Erlang application. This will open a shell on a node where your module is compiled and loaded and you can execute hello:hello_world().

When editing the file, it will be compiled and reloaded automatically after save. You don't need to open a new console, just reuse the original one.

Upvotes: 0

Related Questions