JonesCity
JonesCity

Reputation: 25

Simple Erlang example won't run (error)

Good Afternoon Guys,

I've recently took an interest in Erlang and functional programming. I'm trying to run this simple hello world example without opening the Erlang shell. I'm able to run it successfully in MACOSX (Yosemite) but, I'd like to use my Fedora 20 VM instead. So in Fedora (Linux) (and even Windows 7) I get the following error when trying to run the compiled beam:

{"init terminating in do_boot",{undef,[{heythere,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

These are the switches I use to run the file:

erl -noshell -start -s heythere -init -stop

I even substituted the "-s" switch and used "-run" to no avail. I'm able to run the modules within the shell but NOT outside of it. Is there something I'm doing wrong?

Code:

-module(heythere).
-export([hello_world/0, this_function/0, both/0]).

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

this_function() -> 
  io:fwrite("This is another function...ok~n").

both() ->
  hello_world(),
  this_function().

I tried looking in the erl_crash.dump but it's over 1000+ lines long and I can't make heads or tails of it. :-(

Thank you guys so much in advance.

Upvotes: 0

Views: 554

Answers (1)

mipadi
mipadi

Reputation: 410732

In the -s flag, you specified a module heythere, but no function to use. erl defaults to using start as the function, but you do not specify a start function in your module, so erl doesn't know how to run your program.

Upvotes: 3

Related Questions