1.3.2. The MS-Windows™ world

At present, under MS-Windows™ LEDA supports the development environments MS Visual studio 6, MS Visual C++ .NET, Borland C++, and the Unix™ emulating environment cygwin. For the latter applies what was said in Section 1.3.1.

Most developers write, compile, link, and execute their programs within one of these integrated development environments. Detailed user instructions for all these environments would go beyond the scope of this introduction. All details are described on the corresponding manual page Technical Information.

To give the LEDA freshman a first, guaranteed feeling of success, we describe in this section merely how we can compile and execute HelloLEDAWorld.C in a DOS box under MS-Windows™ NP/2000/XP with the compiler of the Visual Studio 6. (This should be the most common compiler at present.)

Furthermore we assume that we use the MDd-DLLs (Multithreaded DLL Debug) as the runtime library of the compiler. MDd-DLL versions are also contained in the evaluation version of LEDA; so these are always installed on our system.

In addition, the full version of LEDA contains static libraries and DLLs for all of the 6 compiler options MD, MDd, ML, MLd, MT, and MTd. The partitioning of LEDA's classes into static libraries is the same as under Unix™, see Table 1.1 for that. The dynamic libraries always come in pairs. They are called in compliance with the options

Linking has to be performed against the files leda_xxx.lib; the files leda_xxx.dll however are required at runtime. In contrast to the Unix™ version, the complete LEDA system is contained in these libraries (with the exception of the code for GeoWin, see again Table 1.1 for this).

Setting the environment variables for Visual C++

The compiler CL.EXE and the linker LINK.EXE require that the environment variables PATH, INCLUDE and LIB be set suitably. During the installation of Visual C++ the setup program has created a batch file named VCVARS32.BAT, which contains commands for adapting these three variables suitably.

VCVARS32.BAT must be started once from the command line before application programs can be compiled. VCVARS32.BAT is located in the subdirectory bin of the compiler installation, for example in c:\programs\microsoft visual studio 6\vc98\bin. To be able to compile programs together with LEDA, the variables PATH, LIB and INCLUDE must additionally include the corresponding LEDA directories.

Setting the environment variables for LEDA

In the following, we denominate the root directory of LEDA by <LEDAROOT>. This is the directory which we have specified during the installation procedure as the installation directory. We execute the following steps successively:

  1. In the menu Start we click on Settings, then on Control Panel.

  2. We double-click System in Control Panel.

  3. The last step depends on the version of our operating system:

    • Under MS-Windows™ NT, we click on the tab Environment in the dialogue box System Properties.
    • Under MS-Windows™ 2000 and XP, we click on the tab Extended and then on Environment Variables.

    If an environment variable PATH, LIB, or INCLUDE already exists, we expand its current value as follows

    • Expand PATH by <LEDAROOT>.
    • Expand INCLUDE by <LEDAROOT>\incl.
    • Expand LIB by <LEDAROOT>.

    If one or all of these variables do not exist, we add a new user variable PATH, LIB and/or INCLUDE with value <LEDAROOT> and <LEDAROOT>\incl, respectively.

After we have executed these steps, we must invoke VCVARS32.BAT from the command line.

Compiling, linking, and starting

After the environment variables have been set, we can use the LEDA libraries to compile and link HelloLEDAWorld.C (the file itself be located for example in the directory mydir) as follows :

C:\mydir> cl -MDd -DLEDA_DLL -Tp HelloLEDAWorld.C leda_mdd.lib

Here the option -MDd specifies the runtime library of the compiler (Multithreaded DLL Debug) and the flag -DLEDA_DLL is necessary to be able to use the DLL version of LEDA (this one is contained in the evaluation version).

The option -Tp is always necessary when the C++ source files do not end on .cpp in order to tell the compiler that it is facing C++ source code.

Now, an executable file should have been made:

C:\mydir> dir HelloLEDAWorld.*
HelloLEDAWorld  HelloLEDAWorld.C

Hooray! We are now ready to make a large step on our way to a perfect LEDA developer:

C:\mydir> HelloLEDAWorld
Hello LEDA world! 

And as mentioned before, from now on the remainder is no longer hard ...




Imprint-Dataprotection