COIN-OR::LEMON - Graph Library

source: lemon-tutorial/getting_started.dox @ 57:18404ec968ca

Last change on this file since 57:18404ec968ca was 57:18404ec968ca, checked in by Peter Kovacs <kpeter@…>, 11 years ago

Various small fixes

File size: 2.6 KB
RevLine 
[3]1/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library.
4 *
[32]5 * Copyright (C) 2003-2010
[3]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
[11]19namespace lemon {
[3]20/**
[26]21[PAGE]sec_hello_lemon[PAGE] Compile Your First Code
[6]22
[25]23First 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
25Guide</b></a> for instructions).
26In this section, we assume that you use a Linux environment and
27<a href="http://gcc.gnu.org/">GCC</a> compiler.
28
29Once you have installed the library, you may paste the following code segment
30into a file <tt>hello_lemon.cc</tt> to have a first working program that uses
31LEMON.
[6]32
33\dontinclude hello_lemon.cc
34\skip #include
35\until }
36
[25]37In this small example, a directed graph is created with two nodes and
[16]38an arc added to it.
[6]39
[16]40Now let us compile this code.
41(We suppose that you have it in a file called <tt>hello_lemon.cc</tt>.)
[6]42
[16]43If LEMON is installed <b>system-wide</b> (into directory \c /usr/local),
[9]44then it is very easy to compile this program with the
[6]45following command (the argument <tt>-lemon</tt> tells the compiler
[16]46that we are using the installed LEMON).
[6]47
48\verbatim
[23]49g++ -o hello_lemon hello_lemon.cc -lemon
[6]50\endverbatim
51
[57]52As a result you will get the executable \c hello_lemon in the current
[6]53directory, which you can run by the following command.
54
55\verbatim
56./hello_lemon
57\endverbatim
58
[16]59If LEMON is installed <b>user-local</b> into a directory
[18]60(e.g. <tt>~/lemon</tt>), then compiling the code is a bit more difficult.
[6]61You have to issue a command like this.
62
63\verbatim
[23]64g++ -o hello_lemon -I ~/lemon/include hello_lemon.cc -L ~/lemon/lib -lemon
[6]65\endverbatim
66
67If everything has gone well, then our program prints out the followings.
68
69\verbatim
[16]70Hello World! This is LEMON library here.
71We have a directed graph with 2 nodes and 1 arc.
[6]72\endverbatim
73
74If you managed to compile and run this example code without any problems,
[16]75you may go on reading this tutorial to get to know the basic notions,
[25]76features and tools of LEMON. However, if you encountered problems that
[16]77you did not manage to solve, do not hesitate to
[6]78<a href="mailto:lemon-user@lemon.cs.elte.hu"><b>contact us</b></a>.
79
[10]80[TRAILER]
[3]81*/
[11]82}
Note: See TracBrowser for help on using the repository browser.