# Blepo Download

## Downloading the library

Blepo versions available for download:

- Version 0.6.7 (16 Aug 2010) (22 MB)

History of versions

## Setting up your system

Once you have downloaded the code and unzipped it, you will need to do the following to set up your system.

1. The DLLs in the `external/bin` directory must be in your path. This can be accomplished on WindowsXP / Windows7 by selecting `Start Menu -> Control Panel -> System -> Advanced -> Environment Variables -> Path -> Edit`. In the edit box, append the full path to that directory, preceded by a semicolon with no extra spaces, for example, "`;c:/blepo/external/bin`" (without the quotes). (If you already have Visual Studio running, then close and restart it in order to load the new path.)

In addition, if you wish to capture images from a camera (e.g., USB webcam, Data Translation DT3120, or IEEE 1394), you will need to install the appropriate driver(s). For IEEE1394, you need to set it to use the CMU driver by following the instructions in `Capture/CaptureIEEE1394.h`. If you have any trouble, see the help in `blepo/external/doc/IEEE1394`. After installing the driver, you may test your camera using Blepo code or the CMU test application in `blepo/external/bin/1394CameraDemo.exe`

## Getting started with Visual Studio 2008

Once you have performed these steps, you should be able to open `Demo/Demo.sln` in Visual Studio, compile the code, and run. This solution is a good starting point for learning how to build an executable using the library.

To create a new project to use Blepo,

1. Create a project with `File -> New -> Project`
   - Either `Win32 Console Application -> An application that supports MFC`, or
   - `MFC Application` (click "Application Type" and select "Dialog based", which is the simplest choice)
2. Make the project use the Blepo library.
   - In the Solution Explorer, right click on 'Solution' -> Add -> Existing project. Select `blepo/src/blepo.dsp`
   - Make your project dependent upon Blepo (`Project -> Dependencies`, check the box next to `Blepo`)
3. Project -> Properties -> Configuration Properties -> General -> Character set. Set to "Use Multi-Byte Character Set" (This will remove the compilation errors related to character strings.)
4. Project -> Properties -> Configuration properties -> Linker -> Input -> Ignore specific library. Add LIBCMT.lib
5. Include the Blepo header file (`#include "blepo.h"`). For the compiler to find this file, you will need to do one of the following:
   - Add the `blepo/src` path to your project include path (`Project -> Properties -> C/C++ -> General -> Additional include directories`), or
   - add the path to your VC++ list of include directories (`Tools -``> Options -> Projects and solutions -> VC++ Directories -> Show directories for 'Include` files'), or
   - put the path into the `#include` statement.
6. Now build the project and run.

Some common errors:

1. 'nasmw.exe' is not recognized as an internal or external command, operable program or batch file.
   - You forgot to add `c:/blepo/external/bin to your path`
2. error LNK2005: _sprintf already defined in msvcrtd.lib(MSVCR90D.dll)
   - You forgot to tell Visual Studio to ignore LIBCMT.lib
3. error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)'
   - You forgot to set the project to "Use Multi-Byte Character Set"
4. WINVER not defined. Defaulting to 0x0600 (Windows Vista)
   - Right click Blepo, then Properties -> Configuration Properties -> C/C++-> Preprocessor ->
     Preprocessor definitions. Add _WIN32_WINNT=0x500;
5. warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
   - Right click Blepo, then Properties -> Configuration Properties -> C/C++-> Preprocessor ->
     Preprocessor definitions. Add _CRT_SECURE_NO_WARNINGS

## Getting started with VS6.0

Once you have performed the steps in "Setting up your system" above, you should be able to open `Demo/Demo.dsw` in Visual C++ 6.0, compile the code, and run. This workspace will be a good starting point for learning how to build an executable using the library. However, you may first have to add the gsl (GNU scientific library) path to your include directory:

- In Visual C++ 6.0, `Tools -> Options -> Directories -> Include files -> add blepo\external\WinGsl`, where `blepo` is the path to your Blepo directory.

In addition,

- The NASM assembler, which is used to compile the assembly code, must be in your executable path. The name of this file is `nasm.exe` and it resides in the `external/bin` directory. For some inexplicable reason the step above to modify your environment path does not solve this problem for VS6.0, so you have to copy the `nasm.exe` file to an existing directory on your path, such as `C:/Windows/System32`.

To create a new project to use Blepo,

1. Create a project with `File -> New -> Project`
   - Either `Win32 Console Application -> An application that supports MFC`, or
   - `MFC App Wizard` (Dialog based is the simplest, but the other application types should work as well)
2. Make the project use the Blepo library.
   - The simplest option is to add Blepo to the workspace and make the project dependent upon Blepo. More specifically,
     1. `Project -> Insert Project into Workspace`
     2. Select `blepo/src/blepo.dsp`
     3. Set your project to the active project again (`Project -> Set Active Project`)
     4. Make your project dependent upon Blepo (`Project -> Dependencies`, check the box next to `Blepo`)
   - Alternatively, you can compile Blepo separately and just add the .lib files to the project (the `blepo.lib` file as well as all the other `.lib` files in the Blepo project).
3. Include the Blepo header file (`#include "blepo.h"`). For the compiler to find this file, you will need to do one of the following:
   - Add the `blepo/src` path to your project include path (`Project -> Settings -> C/C++ -> Additional include directories`), or
   - Add the path to your VC++ list of include directories (`Tools -> Options -> Directories -> Include directories`), or
   - Put the path into the `#include` statement.
4. Since OpenCV (as of version 2.0) is no longer compatible with VS6.0, you will have to tell Blepo to use the old version of OpenCV. Either
   - manually uncomment the line #define BLEPO_I_AM_USING_VISUAL_CPP_60__ in blepo.h, or
   - insert the constant into the compiler directives using `Project -> Settings -> C/C++ -> Preprocessor definitions`
5. Now build the project and run.

Enjoy!