Need help Simple interconnection problem

NavaTux navaneethanit@REDACTED
Tue Mar 23 20:52:12 CET 2010


I have written a code 1.erl which i wanna to be connected with 2.erl
to make the link for print some information

1.erl

-module(1).
-Author("nava").
-export([start/0,loop/1]).
start() ->

      Pid = spawn(fun()->loop() end),
      register(nava,Pid).



loop()->
	receive

       		message->
			io:format("This is ur message Nava:~n",[]),
			2:start();                   //to execute 2.erl

		_->
			io:format("Empty"),
			void

		end.



2.erl


-module(2).
-export([start/0,print/1]).

start()->

	Pid1=spawn(fun() -> print() end).

print()->

      receive

           welcome->

		io:format("Success:~n");

		_->

		io:format("try once again u ll get success~n");
	end.

when i used to compile


(nitrogen@REDACTED)3> sync:go().
Recompile: ./src/libs/2
./src/libs/2.erl:1: bad module declaration
./src/libs/2.erl:19: syntax error before: 'end'
./src/libs/2.erl:2: no module definition
./src/libs/2.erl:2: function print/1 undefined
./src/libs/2.erl:6: function print/0 undefined
./src/libs/2.erl:6: Warning: variable 'Pid1' is unused
ok


what does go wrong here?
why it happens?/
help me plz!!




More information about the erlang-questions mailing list