1. Building the directory structure
In my example, the project folder is Bank1
Ebin directory: storing compiled beam files
Include directory: storing HRL files
SRC directory: Storing erl source Files
2. Create a Emakefile file
At compile time, the compiler will handle the Emakefile file as appropriate.
{[' src/* '% specify the erl source file directory],[debug_info,{i, "include"} percent specifies the Include folder, {OutDir, "Ebin"} percent to specify the compiled beam file directory]}.
2, write the compilation script Make.bat
Erl-s make all-s C qpause
Set the-s startup parameter,
-S makes all equivalent to execute Make:all () in Erlang Shell to compile
-S C q equivalent to an Erlang shell executing c:q () exiting the Erlang shell
3. Write the Startup function
File name is Bank.erl
-module (Bank)-export ([start/0]). Start ()->application:start (bank).
Put the Bank.erl file in the SRC directory
3. Write the startup script
@echo Offstart Werl-pa ebin-s bankexit
The start in the script is the Bat command, which starts a separate window to execute Werl
-pa Ebin means to add Bank1/ebin path to Erlang's search path
-S Bank means execute bank:start after starting Erlang shell ()
4. Running Make.bat
5. Running Start.bat
See output:
Percent [<0.34.0>bank_app:10] Start Bank_app ...
That the application, named Bank, has been activated.
6. Sample code Download
Address: http://download.csdn.net/detail/u011471961/8367873
Getting Started with Erlang: Building application Exercise 3 (random start)