1 /** |
1 /** |
2 \page getstart How to start using LEMON |
2 \page getstart How to start using LEMON |
3 |
3 |
4 In this page we detail how to start using LEMON, from downloading it to |
4 In this page we detail how to start using LEMON, from downloading it to |
5 your computer, through the steps of installation to showing a simple |
5 your computer, through the steps of installation to showing a simple |
6 "Hello World" type program that already uses LEMON. If anything is not |
6 "Hello World" type program that already uses LEMON. We assume that you have a |
|
7 basic knowledge of your operating system and \c C++ or \c C |
|
8 programming language. If anything is not |
7 clear write to our FAQ. |
9 clear write to our FAQ. |
8 |
10 |
9 \todo Is this FAQ thing a good idea here? Is there such a thing? If |
11 \todo Is this FAQ thing a good idea here? Is there such a thing? If |
10 twice YES then a link comes here. |
12 twice YES then a link comes here. |
11 |
13 |
|
14 \section requirementsLEMON Hardware and software requirements |
12 |
15 |
|
16 Hardware requirements ... |
|
17 |
|
18 You will also need a C++ compiler. We mostly used the Gnu C++ Compiler (g++), |
|
19 from version 3.0 upwards. We also checked the Intel C compiler |
|
20 (icc). Unfortunately, Visual C++ compiler knows not enough to compile the |
|
21 library, so if you are using Microsoft Windows, then try to compile under |
|
22 Cygwin. |
|
23 |
|
24 Ide kell írni: |
|
25 |
|
26 -Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell) |
|
27 - |
|
28 |
|
29 In this description we will suppose a linux environment and Gnu C Compiler. |
13 |
30 |
14 \section downloadLEMON How to download LEMON |
31 \section downloadLEMON How to download LEMON |
15 |
32 |
16 You can download LEMON from the LEMON web site: |
33 You can download LEMON from the LEMON web site: |
17 http://lemon.cs.elte.hu |
34 http://lemon.cs.elte.hu |
18 by following the download link. There you will find the issued distributions in form of \e .ta.gz files. If you want a developer version (for example you want to contribute in developing the library LEMON) then you might want to use our Subversion repository. This case is not detailed here, so from now on we suppose that you downloaded a tar.gz file. |
35 by following the download link. There you will find the issued distributions |
|
36 in form of <tt> .tar.gz </tt> files. If you want a developer version (for example you want to contribute in developing the library LEMON) then you might want to use our Subversion repository. This case is not detailed here, so from now on we suppose that you downloaded a tar.gz file. |
|
37 |
19 |
38 |
20 |
39 |
21 \section installLEMON How to install LEMON |
40 \section installLEMON How to install LEMON |
22 |
41 |
23 In order to install LEMON you have to do the following |
42 In order to install LEMON you have to do the following |
24 |
43 |
25 Download the tarball and issue the following commands: |
44 Download the tarball (named <tt>lemon-x.y.z.tar.gz</tt> where \c x,\c y and \c z are |
|
45 numbers indicating the version of the library: in our example we will have lemon-0.3.1) and issue the following commands: |
26 |
46 |
27 \code |
47 \code |
28 tar xvzf lemon-0.3.1.tar.gz |
48 tar xvzf lemon-0.3.1.tar.gz |
29 cd lemon-0.3.1 |
49 cd lemon-0.3.1 |
30 ./configure |
50 ./configure |
31 make |
51 make |
32 make check (This is optional, but recomended. It runs a bunch of tests.) |
52 make check (This is optional, but recomended. It runs a bunch of tests.) |
33 make install |
53 make install |
34 \endcode |
54 \endcode |
35 |
55 |
36 These commands install LEMON under /usr/local. If you want to install it to some other place, then pass the --prefix=DIR flag to ./configure. |
56 These commands install LEMON under \c /usr/local (you will probably need \c root |
|
57 privileges to be able to install to that directory). If you want to install it |
|
58 to some other place, then pass the \c --prefix=DIR flag to \c ./configure. In |
|
59 what follows we will assume that you were able to install to directory \c |
|
60 /usr/local, otherwise some extra care is to be taken to use the library. |
37 |
61 |
38 Ide kell írni: |
62 We briefly explain these commands below. |
39 |
63 |
40 -Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell) |
64 \code |
41 - |
65 tar xvzf lemon-0.3.1.tar.gz |
|
66 \endcode |
|
67 This command untars the <tt>tar.gz</tt> file into a directory named <tt> lemon-0.3.1</tt>. |
|
68 |
|
69 \code |
|
70 cd lemon-0.3.1 |
|
71 \endcode |
|
72 Enters the directory. |
|
73 |
|
74 \code |
|
75 ./configure |
|
76 \endcode |
|
77 Does some configuration (creates makefiles etc). |
|
78 |
|
79 \code |
|
80 make |
|
81 \endcode |
|
82 This command compiles the <tt> .cc</tt> files of the library package (the |
|
83 implementation of non-template functions and classes and some test and demo |
|
84 programs) and creates the very important <b> libemon.la </b> file. When |
|
85 linking your program that uses LEMON it needs to access this file. |
|
86 |
|
87 \code |
|
88 make check (This is optional, but recomended. It runs a bunch of tests.) |
|
89 \endcode |
|
90 This is an optional step: it runs the test programs that we developed for |
|
91 LEMON to check |
|
92 whether the library works properly on your platform. |
|
93 |
|
94 \code |
|
95 make install |
|
96 \endcode |
|
97 This will copy the directory structure to its final destination (e.g. to \c |
|
98 /usr/local) so that your system can access it. |
42 |
99 |
43 \section helloworld My first program using LEMON |
100 \section helloworld My first program using LEMON |
44 |
101 |
45 If you have installed LEMON on your system you can paste the following code |
102 If you have installed LEMON on your system you |
|
103 can paste the following code |
46 segment into a file to have a first working program that uses library LEMON. |
104 segment into a file to have a first working program that uses library LEMON. |
47 |
105 |
48 \code |
106 \code |
49 #include <iostream> |
107 #include <iostream> |
50 #include <lemon/list_graph.h> |
108 #include <lemon/list_graph.h> |
97 |
152 |
98 We can also iterate through all edges of the graph very similarly. The |
153 We can also iterate through all edges of the graph very similarly. The |
99 \c target and |
154 \c target and |
100 \c source member functions can be used to access the endpoints of an edge. |
155 \c source member functions can be used to access the endpoints of an edge. |
101 |
156 |
102 The previous code fragment prints out the following: |
157 If you have saved the preceding code into a file named, say, \c hemon.cc and your installation of LEMON into directory \c /usr/local was |
|
158 successful then it is very easy to compile this program with the following |
|
159 command (the argument <tt>-lemon</tt> tells the compiler that we are using the |
|
160 installed library LEMON): |
|
161 \code |
|
162 g++ hemon.cc -o hemon -lemon |
|
163 \endcode |
|
164 |
|
165 As a result you will get the exacutable \c hemon in |
|
166 this directory that you can run by the command |
|
167 \code |
|
168 ./hemon |
|
169 \endcode |
|
170 |
|
171 |
|
172 If everything has gone well then the previous code fragment prints out the following: |
103 |
173 |
104 \code |
174 \code |
105 Nodes: 2 1 0 |
175 Nodes: 2 1 0 |
106 |
176 |
107 Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0) |
177 Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0) |
108 \endcode |
178 \endcode |
109 |
179 |
|
180 Congratulations! |
110 |
181 |
111 If you want to see more features, go to the \ref quicktour "Quick Tour to |
182 If you want to see more features, go to the \ref quicktour "Quick Tour to |
112 LEMON", if you want to see see some demo programs then go to our |
183 LEMON", if you want to see see some demo programs then go to our |
113 \ref demoprograms "Demo Programs" page! |
184 \ref demoprograms "Demo Programs" page! |
114 |
185 |