Reputation: 1522
Trying to run simple erlang file in intellij.
-module('Tutorial').
%% API
-export([helloWorld/0]).
helloWorld() -> io:write("Hello World").
But when I try to run I always get
init terminating in do_boot ()
{"init terminating in do_boot",{{unbound_var,'Tutorial'},[{erl_eval,exprs,2,[]}]}}
Crash dump is being written to: erl_crash.dump...done
Im using erlang 8.3 and a intellij plugin for erlang.
Upvotes: 2
Views: 982
Reputation: 511
Sort of- atoms (which module names are) can be capitalized if surrounded by single quotes, as seen here. I'm not sure how you're running the code, but the following illustrates (the code is in Foo.erl).
-module('Foo').
-export([bar/0]).
bar() ->
io:format("foobar~n").
And then
1> c("Foo.erl").
{ok,'Foo'}
2> 'Foo':bar().
foobar
ok
3>
Upvotes: 2
Reputation: 1380
Use:
-module('tutorial').
in a file called: "tutorial.erl". The expression: "Tutorial" is interpreted as a variable (because the first letter is capitalized). When the runtime encounters this variable, it tries to evaulate it, but since it is not defined, you get the error.
Upvotes: 4