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