1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2010
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
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.
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
21 [PAGE]sec_hello_lemon[PAGE] Compile Your First Code
23 First of all, you have to install LEMON on your system (see the
24 <a href="http://lemon.cs.elte.hu/trac/lemon/wiki/InstallGuide"><b>Installation
25 Guide</b></a> for instructions).
26 In this section, we assume that you use a Linux environment and
27 <a href="http://gcc.gnu.org/">GCC</a> compiler.
29 Once you have installed the library, you may paste the following code segment
30 into a file <tt>hello_lemon.cc</tt> to have a first working program that uses
33 \dontinclude hello_lemon.cc
37 In this small example, a directed graph is created with two nodes and
40 Now let us compile this code.
41 (We suppose that you have it in a file called <tt>hello_lemon.cc</tt>.)
43 If LEMON is installed <b>system-wide</b> (into directory \c /usr/local),
44 then it is very easy to compile this program with the
45 following command (the argument <tt>-lemon</tt> tells the compiler
46 that we are using the installed LEMON).
49 g++ -o hello_lemon hello_lemon.cc -lemon
52 As a result you will get the exacutable \c hello_lemon in the current
53 directory, which you can run by the following command.
59 If LEMON is installed <b>user-local</b> into a directory
60 (e.g. <tt>~/lemon</tt>), then compiling the code is a bit more difficult.
61 You have to issue a command like this.
64 g++ -o hello_lemon -I ~/lemon/include hello_lemon.cc -L ~/lemon/lib -lemon
67 If everything has gone well, then our program prints out the followings.
70 Hello World! This is LEMON library here.
71 We have a directed graph with 2 nodes and 1 arc.
74 If you managed to compile and run this example code without any problems,
75 you may go on reading this tutorial to get to know the basic notions,
76 features and tools of LEMON. However, if you encountered problems that
77 you did not manage to solve, do not hesitate to
78 <a href="mailto:lemon-user@lemon.cs.elte.hu"><b>contact us</b></a>.