1 | /* -*- mode: C++; indent-tabs-mode: nil; -*- |
---|
2 | * |
---|
3 | * This file is a part of LEMON, a generic C++ optimization library. |
---|
4 | * |
---|
5 | * Copyright (C) 2003-2008 |
---|
6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
8 | * |
---|
9 | * Permission to use, modify and distribute this software is granted |
---|
10 | * provided that this copyright notice appears in all copies. For |
---|
11 | * precise terms see the accompanying LICENSE file. |
---|
12 | * |
---|
13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
14 | * express or implied, and with no claim as to its suitability for any |
---|
15 | * purpose. |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | namespace lemon { |
---|
20 | /** |
---|
21 | [PAGE]hello_lemon[PAGE] Compile Your First Code |
---|
22 | |
---|
23 | First of all you have to install LEMON on your system (see |
---|
24 | \ref install for instructions). |
---|
25 | After that you can paste the following code segment into a file |
---|
26 | <tt>hello_lemon.cc</tt> to have a first working program that uses LEMON. |
---|
27 | |
---|
28 | \dontinclude hello_lemon.cc |
---|
29 | \skip #include |
---|
30 | \until } |
---|
31 | |
---|
32 | In this small example a directed graph is created with two nodes and |
---|
33 | an arc added to it. |
---|
34 | |
---|
35 | Now let us compile this code. |
---|
36 | (We suppose that you have it in a file called <tt>hello_lemon.cc</tt>.) |
---|
37 | |
---|
38 | If LEMON is installed <b>system-wide</b> (into directory \c /usr/local), |
---|
39 | then it is very easy to compile this program with the |
---|
40 | following command (the argument <tt>-lemon</tt> tells the compiler |
---|
41 | that we are using the installed LEMON). |
---|
42 | |
---|
43 | \verbatim |
---|
44 | g++ -lemon hello_lemon.cc -o hello_lemon |
---|
45 | \endverbatim |
---|
46 | |
---|
47 | As a result you will get the exacutable \c hello_lemon in the current |
---|
48 | directory, which you can run by the following command. |
---|
49 | |
---|
50 | \verbatim |
---|
51 | ./hello_lemon |
---|
52 | \endverbatim |
---|
53 | |
---|
54 | If LEMON is installed <b>user-local</b> into a directory |
---|
55 | (e.g. <tt>~/lemon</tt>), then compiling the code is a bit more difficult. |
---|
56 | You have to issue a command like this. |
---|
57 | |
---|
58 | \verbatim |
---|
59 | g++ -lemon -I ~/lemon/include -L ~/lemon/lib hello_lemon.cc -o hello_lemon |
---|
60 | \endverbatim |
---|
61 | |
---|
62 | If everything has gone well, then our program prints out the followings. |
---|
63 | |
---|
64 | \verbatim |
---|
65 | Hello World! This is LEMON library here. |
---|
66 | We have a directed graph with 2 nodes and 1 arc. |
---|
67 | \endverbatim |
---|
68 | |
---|
69 | If you managed to compile and run this example code without any problems, |
---|
70 | you may go on reading this tutorial to get to know the basic notions, |
---|
71 | features and tools of LEMON. However if you encountered problems that |
---|
72 | you did not manage to solve, do not hesitate to |
---|
73 | <a href="mailto:lemon-user@lemon.cs.elte.hu"><b>contact us</b></a>. |
---|
74 | |
---|
75 | [TRAILER] |
---|
76 | */ |
---|
77 | } |
---|