Strong blog: http://wgcode.iteye.com/blog/964722
I. Related Materials
The official website of Erlang is http://www.erlang.org. The link on the left of it points out the resources we can get from here.
Where,
Downloads connections can be downloaded to all versions of Erlang.
Links is a link to some other resources.
Enhancements is an enhancement of Erlang.
Getting started is teaching
Documentation document, which is equivalent to a Help File
Examples example
Ii. Installation
Take Windows installation as an example. Download the latest Windows binary version. For example, r14b01. The downloaded file is named otp_win32_r14b01.exe and can be directly installed. This step is very important to set the path after installation!
Method 1,
Add the Bin (such as C:/erl5.8.2/bin) to the path of the system variable (right-click my computer/properties/advanced/environment variables ).
Method 2,
Add the el_paths value to the environment variable to the corresponding bin path. Then add % el_paths % to path. This method is automatically completed based on method 1 when Erlang is used in eclipse.
Iii. Check whether Erlang is successfully installed
Open cmd, enter ERL, and press Enter. If the following information is displayed, the installation is successful.
4. Use eclipse
Requirements for Erlang development in eclipse
1. Eclipse versions 3.5.0 to 3.5.2
2. JDK 1.5
3. erlide
OK, install JDK 1.5 First, run the decompressed eclipse (preferably with only the Java version), and then update with the http://erlide.org/update in help/install new software. Select
You can. Restart eclipse after installation. Done!
5. The first Erlang Hello world!
1. Open eclipse, new/project/Erlang Project
Enter the project name "helloworld" and click Finish.
Eclipse automatically creates three folders.
Where:
Ebin stores compiled binary files (with the extension beam)
Include stores the files referenced in the program
SRC stores source code files
2. Right-click SRC and select new module to create an Erlang file (the extension is ERL)
Enter "HW" in Module name ". Note: The name must be in lowercase English or underline. Click Finish
3. Compile the print function
Enter the following code
Printhelloworld ()->
IO: Format ("Hello world !~ N ").
OK. Write printhelloworld to-export to export the function. For example,-Export ([printhelloworld/0]). Here 0 indicates no parameter.
Note: The function name must be in lower case and in upper case, it must be a variable. The function format is
Method Name (parameter)->
Method body.(Note that the ending point here is the sentence of an English file)
3. Compile
Right-click HW. erl and select Run as/run deployments...
Double-click Erlang application to generate a new configuration.
Select your project on the right
Enter a node name under runtimes
Click Apply to run the task.
This will appear in the console
The compilation command is C (file name ).
Enter C (HW). and press Enter.
At this time, an error is prompted: there is no corresponding file.
Use PWD () to view the current path
The directory SRC where HW. erl is located is not identified. So we use the CD command to go to this directory.
Then you can compile it.
After compilation, the corresponding HW. Beam file will be generated in the Ebin directory. Run the following command:
OK. The first helloworld program is complete.
6. Recommended books
Erlang programming (English version)
VII. Help Files
The Erlang help file can be found in the doc directory (for example, C:/erl5.8.2/DOC.