2012. 3. 18.

erlang compile with other module.

If you make your own modules.  You want to use them.
You can use 'import' command as you expected.

-import(modulename, function_name).

but sometimes you will meet  'some errors'.

If your code is as below.


 -import(mod1, [get/1]).

When you compile, you will meet error


 import directive overrides pre R14 auto-imported BIF get/1
 - use "-compile({no_auto_import,[get/1]})." to resolve name clash 

Yes, you muse add  line 

-compile({no_auto_import,[get/1]}).
 -import(mod1, [get/1]).


2012. 3. 12.

simple compile erlang

I read that  I must use 'c' to compile in erlang. but I met error 'write error'.
I  am googling and then  I know that I must change directory with 'cd' command.
It is simple. but before I found it  It was stress to statr to learn the erlang.



c("modulefilename").   % sometimes you will meet error ' writing error'


%% method 1: you need to change working directory.

cd("pathname"). %%  which includes module file
c("modulefilename").

%% method 2  

c("modulename", [{outdir, "output directory .."}]).  %% you can assign output directory option  by {outdir, "..."} .