/* -*- mode: C++; indent-tabs-mode: nil; -*- * * This file is a part of LEMON, a generic C++ optimization library. * * Copyright (C) 2003-2010 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ namespace lemon { /** [PAGE]sec_hello_lemon[PAGE] Compile Your First Code First of all, you have to install LEMON on your system (see the Installation Guide for instructions). In this section, we assume that you use a Linux environment and GCC compiler. Once you have installed the library, you may paste the following code segment into a file hello_lemon.cc to have a first working program that uses LEMON. \dontinclude hello_lemon.cc \skip #include \until } In this small example, a directed graph is created with two nodes and an arc added to it. Now let us compile this code. (We suppose that you have it in a file called hello_lemon.cc.) If LEMON is installed system-wide (into directory \c /usr/local), then it is very easy to compile this program with the following command (the argument -lemon tells the compiler that we are using the installed LEMON). \verbatim g++ -o hello_lemon hello_lemon.cc -lemon \endverbatim As a result you will get the exacutable \c hello_lemon in the current directory, which you can run by the following command. \verbatim ./hello_lemon \endverbatim If LEMON is installed user-local into a directory (e.g. ~/lemon), then compiling the code is a bit more difficult. You have to issue a command like this. \verbatim g++ -o hello_lemon -I ~/lemon/include hello_lemon.cc -L ~/lemon/lib -lemon \endverbatim If everything has gone well, then our program prints out the followings. \verbatim Hello World! This is LEMON library here. We have a directed graph with 2 nodes and 1 arc. \endverbatim If you managed to compile and run this example code without any problems, you may go on reading this tutorial to get to know the basic notions, features and tools of LEMON. However, if you encountered problems that you did not manage to solve, do not hesitate to contact us. [TRAILER] */ }