***************************************************************************** * * * AGD and LEDA Windows NT/95/98/200 * * * * MSVC++ 5.0/6.0 * * * * Static Libs * * * ***************************************************************************** Remark: Starting with AGD version 1.2, the commercial version of AGD is integrated in a LEDA package. The following procedures therefore are an extension of the installation procedure for the LEDA package. I. Directory Overview --------------------- In this file I use to denote the path name of the AGD/LEDA main directory. It should contain the following files and subdirectories: AGD\Install\win32_lib.txt this file AGD\Install\win32_dll.txt install and use DLLs of AGD and LEDA Install\win32_lib.txt install and use static libs of LEDA Install\win32_dll.txt install and use DLLs of LEDA incl\ the AGD and LEDA include directory and at least one of the following library sets - libagd_ml.lib, libl_ml.lib, libg_ml.lib, libg2_ml.lib, libp_ml.lib, libw_ml.lib, libgeow_ml.lib, libd3_ml.lib - libagd_mld.lib, libl_mld.lib, libg_mld.lib, libg2_mld.lib, libp_mld.lib, libw_mld.lib, libgeow_mld.lib, libd3_mld.lib - libagd_md.lib, libl_md.lib, libg_md.lib, libg2_md.lib, libp_md.lib, libw_md.lib, libgeow_md.lib, libd3_md.lib - libagd_mdd.lib, libl_mdd.lib, libg_mdd.lib, libg2_mdd.lib, libp_mdd.lib, libw_mdd.lib, libgeow_mdd.lib, libd3_mdd.lib - libagd_mt.lib, libl_mt.lib, libg_mt.lib, libg2_mt.lib, libp_mt.lib, libw_mt.lib, libgeow_mt.lib, libd3_mt.lib - libagd_mtd.lib, libl_mtd.lib, libg_mtd.lib, libg2_mtd.lib, libp_mtd.lib, libw_mtd.lib, libgeow_mtd.lib, libd3_mtd.lib II. Compiling and Linking Application Programs in Microsoft Visual Studio ------------------------------------------------------------------------- To compile and link an application program using AGD and LEDA in Microsoft Visual Studio proceed as follows: 1) In the "File" menu of Visual Studio click on "New" 2) Choose "Win 32 Console Application" in "Projects", fill in the project name, and click "OK" 3) Choose "Empty Project" and click "Finish" 4) After clicking "OK" you have an empty project space If you already have a source file "prog.cpp": 5) Activate the file browser and add "prog.cpp" to the main folder of your project 6) In the "Workspace" of Visual Studio click on "Source Files" with the right mouse button, then click on "Add File to Folder" with the left mouse button 7) Double click on "prog.cpp" If you want to enter a new source file: 5') In the "File" menu click on "New" 6') Choose "C++ Source File" in "Files", fill in the file name, and click "OK" 7') Enter your code 8) In the "Project" menu click on "Settings" 9) Choose "C/C++" and enter in "Project Options" the compiler flag you want to use. The default value is "/MLd", alternatives are "/ML", "/MD", "/MDd", "/MT", and "/MTd". Notice that you have to use the AGD and LEDA libraries that correspond to the chosen flag, e.g., with option "/MD" you must use libagd_md.lib, libl_md.lib, libg_md.lib, libp_md.lib, libw_md.lib. Using another set of libraries with "/MD" will lead to serious linker errors. 10) Choose "Linker" and add the name of the AGD and LEDA libraries you want to use at the beginning of line "Object-/Library-Modules" as follows. I use to indicate the compiler option chosen in Step 9) (,i.e., is mld for "/MLd", ml for "/ML", ...). - "libagd_.lib libp_.lib libg_.lib libl_.lib" for programs without LEDA windows - "libagd_.lib libw_.lib libp_.lib libg_.lib libl_.lib wsock32.lib" for programs using LEDA windows 11) Click "OK" to leave the "Settings" 12) In the "Extras" menu click on "Options" 13) Choose "Directories" 14) Choose "Include Files" in "Show Directories for:" and add the directory "\incl" containing the AGD and LEDA include files (Double click on the small rectangle in "Directories", enter \incl, or click on the small grey rectangle on the right and choose the correct directory.) 15) Choose "Library Files" in "Show Directories for:" and add the directory "" containing the AGD and LEDA libraries. 16) Click "OK" to leave the "Options" 17) In the "Build" menu click on "Build prog.exe" or "Rebuild All" to compile your program. 18) In the "Build" menu click on "Execute prog.exe" to execute your program. Remarks: If your C++ source code files has extension .c, you need to add the option "/Tp" in "Project Options" (Step 9)), otherwise you will get a number of compiler error. Examples of workspaces can be found in the directory /demo/msc_workspaces. III. Adding AGD and LEDA to a Project in Microsoft Visual Studio ---------------------------------------------------------------- To link the AGD and LEDA libraries to an already existing project proceed as follows: 1) Start the Microsoft Visual Studio with your project 2) In the "Project" menu click on "Settings" 3) Choose "C/C++" and check in "Project Options" the compiler flag you use for your project. The default value is "/MLd", alternatives are "/ML", "/MD", "/MDd", "/MT", and "/MTd". Notice that you have to use the AGD and LEDA libraries that correspond to the chosen flag, e.g., with option "/MD" you must use libl_md.lib, libg_md.lib, libp_md.lib, libw_md.lib, libgeow_md.lib, and libd3_md.lib. Using another set of libraries with "/MD" will lead to serious linker errors. 4) Choose "Linker" and add the name of the AGD and LEDA libraries you want to use at the beginning of line "Object-/Library-Modules" as follows. I use to indicate the compiler option chosen in Step 3) (,i.e., is mld for "/MLd", ml for "/ML", ...). - "libagd_.lib libp_.lib libg_.lib libl_.lib" for programs without LEDA windows - "libagd_.lib libw_.lib libp_.lib libg_.lib libl_.lib wsock32.lib" for programs using LEDA windows 5) Click "OK" to leave the "Settings" 6) In the "Extras" menu click on "Options" 7) Choose "Directories" 8) Choose "Include Files" in "Show Directories for:" and add the directory "\incl" containing the AGD and LEDA include files (Double click on the small rectangle in "Directories", enter \incl, or click on the small grey rectangle on the right and choose the correct directory.) 9) Choose "Library Files" in "Show Directories for:" and add the directory "" containing the AGD and LEDA libraries. 10) Click "OK" to leave the "Options" 11) You can now use the data types provided by AGD and LEDA in your project as described in the AGD and LEDA user manual. IV. Compiling and Linking Application Programs in a DOS-Box ------------------------------------------------------------ a) 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 have been set properly. PATH must point to the \bin subdirectory of your Visual C++ installation, LIB must point to \lib, and INCLUDE to \include. When you installed Visual C++, setup created a batch file, VCVARS32.BAT, containing commands to modify the PATH, LIB, and INCLUDE environment variables. Run VCVARS32.BAT before you compile at the command prompt. VCVARS32.BAT is located in the \bin subdirectory. Note that you do not need to run VCVARS32.BAT if you are compiling your program inside the development environment (see above). To run VCVARS32.BAT: - At the command prompt, change to the \bin subdirectory of your Visual C++ installation (for instance c:\programs\microsoft developer studio\vc98\bin ). - Run VCVARS32.BAT by typing VCVARS32. To compile programs together with the AGD and LEDA libraries, the environment variables PATH, LIB, and INCLUDE must additionally contain the corresponding AGD and LEDA directories. There are two possibilities to modify the environment variables. The first can be used to change the variables for a single DOS-box, the second to modify the variables permanently. b) Setting Environment Variables for AGD and LEDA in a single DOS-Box: The AGD and LEDA main directory contains the batch file SET_LEDA_PATHS.BAT This file can be used to change the environment variables as follows - At the command prompt run VCVARS32.BAT as described above. - Change to the AGD and LEDA main directory - Run SET_LEDA_PATHS.BAT by typing SET_LEDA_PATHS (,e.g., if you have LEDA in d:\LEDA-4.3, you type SET_LEDA_PATHS d:\leda-4.3) c) Setting Environment Variables for AGD and LEDA permanently: i) Windows NT/2000: 1. On the "Start" menu, point to "Settings", then click "Control Panel". 2. In the "Control Panel", double click "System". 3. In the System Properties dialog box, click the Environment tab, and specify your environment variable setting for PATH, INCLUDE, and LIB, using the User Variables for, Variable, and Value boxes. If such a user variable already exists, click it in the User Variables for list. The name will then appear in the "Variable" field and its value in the "Value" field. Extend the current value by appending the appropriate AGD and LEDA directory separated by ";" from the existing values as follows: - extend PATH by - extend INCLUDE by \incl - extend LIB by In case a user variable does not exist, enter its name in the "Variable" field and the value in the "Value" field. - set PATH to - set INCLUDE to \incl - set LIB to ii) Windows 95/98: 1. Change the file "autoexec.bat" as follows: If the variables PATH, INCLUDE, or LIB are already set in "autoexec.bat", append the appropriate AGD and LEDA directory separated by ";" from the existing values as follows: - extend PATH by - extend INCLUDE by \incl - extend LIB by If a variable is not set, add it to "autoexec.bat" by writing: set PATH= set INCLUDE=\incl set LIB= 2. Restart Windows 95 for the change to take effect. After these procedures, it suffices to call VCVARS32.BAT at the command prompt. In both cases the AGD and LEDA paths are automatically appended to the compiler paths. d) Compiling and Linking Programs: After setting the environment variables, you can use the libraries as follows to compile and link programs. Programs without LEDA windows: cl -Tp prog.c libg.lib> where and are related as follows: -ML lib*_ml.lib -MLd lib*_mld.lib -MD lib*_md.lib -MDd lib*_mdd.lib -MT lib*_mt.lib -MTd lib*_mtd.lib Remark: The option -Tp is necessary if the C++ source code files have extension .c, if your files have extension .cpp this option is not necessary. Programs using LEDA window: cl -Tp prog.c wsock32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib advapi32.lib where and libs are related analogously to the case above. IV. Using DLLs instead of Static Libraries: ------------------------------------------ Information on how to use DLLs instead of static libraries can be found in win32_dll.txt.