Compiling Erlang code on Windows

前端 未结 6 936
夕颜
夕颜 2021-02-08 03:48

I installed Erlang 13B and tried to follow the tutorials.

Every time I get to c(tut), I get an error instead of (ok, tut), so it seems like the

6条回答
  •  半阙折子戏
    2021-02-08 04:41

    After you install Erlang open the shell and do:

    1> pwd().
    C:/Program Files/erl5.7.1/usr
    ok
    2>
    

    Assume you have a file; "tut.erl" on your desktop. Content might look like this:

    -module(tut).
    -compile(export_all).
    
    hello_world() ->
      hello.
    

    You must change the path of the current working directory to the desktop first (or where ever you want to do the compile). Like this perhaps:

    2> cd("F:/Desktop").
    F:/Desktop
    ok
    3>
    

    Then you can perform the compile.

    3> c(tut).
    {ok,tut}
    4>
    

    Then test the module

    4> tut:hello_world().
    hello
    5> 
    

    More info refer to the documentation here: Erlang official documentation More info on the shell, look here: Shell module

    Hope this gets your started.

提交回复
热议问题