Visual Servoing Platform  version 3.0.0
Tutorial: Installation from source on Windows 8.1 with Mingw-w64

In this tutorial you will learn how to install ViSP from source on Windows 8.1 with Mingw-w64. These steps have been tested on Windows 8.1 (64 bit), with CMake 3.3.2 and Mingw-w64 - GCC for Windows 64 & 32 bits.

Concerning ViSP installation, we provide also other Tutorials.

Install prerequisities


Mingw-w64 could be found following From that page, click on download "Win-builds" that will bring you to the page Here simply download and run the package manager, in our case we downloaded win-builds-1.5.0.exe file.

  • Once downloaded, double click on the the exe file. It will open an installation window.
  • Select x86_64 and Mingw installation folder C:\mingw as in the following image:
    It you want to install Mingw in an other folder, you have to set MINGW_DIR environment variable to your installation location in order to allow CMake to detect 3rd party libraries that come with Mingw installer. Fo example, if you install Mingw in C:\folder\mingw-w64, setting MINGW_DIR is simply done running in a cmd terminal:
    C:> setx MINGW_DIR "C:\folder\mingw-w64"
  • Click on "OK" button. It will open an other window:
  • Where you can click on "Process" button to start the installation
  • A window shows the progression of the installation. When all the packages are installed you can close all the installation windows.
  • To finish the installation, just add C:\mingw\bin folder to the PATH variable. To this end open a cmd terminal and do the following:
    C:> echo %PATH%
    C:> setx PATH "%PATH%;C:\mingw\bin"
  • Close and re-open a cmd terminal, then run again
    C:> echo %PATH%
    to check that C:\mingw\bin was added.


CMake 2.8.3 or higher that could be download at :

  • Download the latest binary distribution installer for Windows. You will find it under "Windows (Win32 Installer)".
  • Install CMake just by double clicking on the binary cmake-x.y.z-win32-x86.exe you downloaded.

Install recommended 3rd parties

ViSP is interfaced with several 3rd party libraries. The complete list is provided here. Some of them are automatically detected since they are part of MinGW distribution. Other may be installed from source. We recommend to install the following:

OpenCV 3rd party

We recommend to install OpenCV.

  • Since OpenCV is not packaged for Mingw, you have to install OpenCV from source. From download the latest OpenCV for Windows version. In our case we install opencv-3.0.0.exe pre-build SDK in C:\OpenCV. The installer opencv-3.0.0.exe extracted all the prebuilt binaries, but also the source code in C:\OpenCV\opencv.
  • Now we have to use CMake to configure OpenCV from source. As <source_dir> we will set C:\OpenCV\opencv\sources and as <binary_dir> we set C:\OpenCV\opencv\sources\build-mingw.
  • Click then on "Configure" button.
  • Click on "Yes" to create C:\OpenCV\opencv\sources\build-mingw folder.
  • Select then "MinGW Makefiles" and click on "Finish" button.
  • Modify "CMAKE_INSTALL_PREFIX" to C:\OpenCV\opencv\build folder. This is the location of the pre-build libraries that come with the installer. Doing that, allows to install OpenCV libraries in a same parent folder.
  • Click then on "Configure" button to remove the red lines.
  • Click on "Generate" button to generate the Makefiles for Mingw.
  • Open a cmd terminal, enter in the <binary_dir> folder and start mingw32-make
    C:\> cd C:\OpenCV\opencv\sources\build-mingw
    C:\OpenCV\opencv\sources\build-mingw> mingw32-make
    Depending on OpenCV version you may encounter the following issues, for which we propose work arrounds; OpenCV build error: struct has virtual functions and accessible non-virtual destructor, OpenCV build error: cannot build with tiff support, or OpenCV link error: cannot find -lRunTmChk.
  • To install OpenCV run:
    C:\OpenCV\opencv\sources\build-mingw> mingw32-make install
  • Now in order that ViSP detects OpenCV you have to set OpenCV_DIR environment variable. Start up cmd terminal and enter:
    setx OpenCV_DIR C:\OpenCV\opencv\build
    where C:\OpenCV\opencv\build is where you have the build directory (extracted or built). Inside this folder you should have a file named OpenCVConfig.cmake.
  • Here the directory is the one where you have installed OpenCV. Inside this folder you should have a file named OpenCVConfig.cmake.
  • You have also to add the location of OpenCV libraries in the PATH environment variable following the indications mentioned in Setting up PATH variable.

Install ViSP from source code

Getting ViSP source code

There are different ways to get ViSP source code.

  • You can download the latest release as a zip or a tarball. Once visp-x.y.z.tar.gz or is downloaded, uncompress the file using for example WinRAR
  • You can also download a daily snapshot. Once visp-snapshot-yyyy-mm-dd.tar.gz is downloaded, uncompress the file using for example WinRAR
  • Or you get the cutting-edge ViSP from GitHub repository using the git command line (see How to install Git):
    C:\ViSP> git clone

We suppose now that ViSP source is in a directory denoted <source_dir>, for example C:\ViSP\visp

Configuring ViSP from source

The goal of the configuration step is now to use CMake to produce all the material requested to build ViSP with Mingw. This material will be located in <binary_dir>, for example C:\ViSP\visp-build.

  • Launch CMake (cmake-gui) and complete the <source_dir> and <binary_dir> locations as in the next image.
  • Click then on "Configure" button.
  • Click on "Yes" to create the C:\ViSP\visp-build folder.
  • Select then "MinGW Makefiles" and click on "Finish" button.
  • This will start CMake configuration. As shown in the next image, OpenCV, ffmpeg, gdi, libjpeg, libpng, pthread and libxml2 3rd party are detected.
    If OpenCV is not detected, you may encounter the following issue OpenCV not detected with Mingw build.
  • As given in the previous image, note also that the installation folder is set to C:\ViSP\visp-build\install.
    If you want to change the installation forder to C:/Program Files (x86)/ViSP, make sure that you have administrator privileges to write in that folder.
  • Click then on "Configure" button. All the red lines should disappear.
    The default configuration lead to the creation of a shared library (with .dll extension). This is the default configuration that is recommended. If you want to create rather a static library (with .lib extension) you have to uncheck the BUILD_SHARED_LIBS option to disable DLL creation.
  • To finish the configuration, click on "Generate" button.
  • Once the generation is done, in C:/ViSP/visp-build folder you have the Makefile file that will be used by Mingw to build the entire project.

Building ViSP from source

  • To build ViSP, open a cmd terminal, change to C:\ViSP\visp-build folder and run mingw32-make:
    C:\> cd C:\ViSP\visp-build
    C:\ViSP\visp-build> mingw32-make
  • Now to install ViSP, in the same cmd terminal run:
    C:\ViSP\visp-build> mingw32-make install
  • At the end, in C:/ViSP/visp-build/install/x64/mingw/bin folder you will find ViSP DLL libraries corresponding to the build modules.
    When CMAKE_BUILD_TYPE is set to Debug, the library names are suffixed by "d".

Setting up PATH variable

If you built static libraries then you are done. Otherwise, if you follow this tutorial step by step you need to add the bin folders path to the systems path. This is because you will use ViSP and OpenCV libraries in form of "Dynamic-link libraries" (also known as DLL). Inside these are stored all the algorithms and information the libraries contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems PATH variable contains a list of folders where DLLs can be found. Add ViSP and OpenCV libraries path to this and the OS will know where to look if he ever needs the libraries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (exe) for the OS to find it.

To modify the PATH var and add the path to ViSP library, open a cmd terminal and run:

C:\> echo %PATH%
C:\> setx PATH "%PATH%;C:\ViSP\visp-build\install\x64\mingw\bin"

Then to add the path to OpenCV 3rd party library, close and re-open a cmd-terminal and run:

C:\> echo %PATH%
C:\> setx PATH "%PATH%;C:\OpenCV\opencv\build\x64\mingw\bin"

Then close and re-open a cmd terminal to check if the PATH var was well positioned

C:\> echo %PATH%

Install ViSP dataset

Some ViSP examples and tests require data (images, video, models) that are not part of ViSP source code but available in a separate archive named This archive could be downloaded from page. We provide here after the way to install these data if you want to run ViSP examples.

Download from and uncompress it for example in C:/ViSP.


We suppose now that the data are located in C:/ViSP/ViSP-images.

C:\> dir ViSP/ViSP-images
Klimt circle ellipse iv mbt mire-2
LICENSE.txt calibration cube ellipse-1 line mire video

ViSP examples and tests are able to detect automatically the location of the requested data if you position an environment variable called VISP_INPUT_IMAGE_PATH. In our case, this variable should be set to C:\ViSP.

For historical reasons VISP_INPUT_IMAGE_PATH should not contain the folder ViSP-images, but the parent folder.

From now, you can try to run ViSP examples and tests. For example, if you want to run <binary dir>/example/device/display/Debug/displayGDI.exe, open a command window, enter in the right folder, and run:


Known issues

OpenCV endianness failure during CMake configuration

This issue occurs with OpenCV 2.4.10, 2.3.0-beta and 2.3.0 releases.

If you encounter the following issue during CMake configuration


Edit C:\OpenCV\opencv\sources\CMakeLists.txt file, and line 464 replace:




OpenCV build error: cannot build with tiff support

This issue occurs with OpenCV 2.4.10, 2.3.0-beta and 2.3.0 releases.

If you encounter a build issue during libtiff build as given in the next image:

  • Open CMake GUI on OpenCV, turn BUILD_TIFF=OFF and also WITH_TIFF=OFF
  • Click on "Configure" button, and then on "Generate" one.
  • Build again OpenCV using
    C:\OpenCV\opencv\sources\build-mingw> mingw32-make

OpenCV link error: cannot find -lRunTmChk

This issue occurs with OpenCV 2.3.0-beta and 2.3.0 releases.

The following image shows the link issue that may appear when building OpenCV with mingw:


A work arround is to configure OpenCV without ipp support turning WITH_IPP=OFF and then trying to build again.

OpenCV build error: struct has virtual functions and accessible non-virtual destructor

This error that occurs with OpenCV 3.0.0 during cap_dshow.cpp build is known and reported as an issue in

  • The fix consists in modifying modules/videoio/src/cap_dshow.cpp by adding near line 96:
    #ifdef __MINGW32__
    // MinGW does not understand COM interfaces
    #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"

OpenCV not detected with Mingw build

This issue occurs with OpenCV 2.4.10 and 2.3.0-beta.
  • To fix this issue, edit C:\OpenCV\opencv\sources\cmake\OpenCVConfig.cmake, and line 89 replace:
  • Then open a new cmd terminal to build and install OpenCV again:
    C:\OpenCV\opencv\sources\build-mingw> mingw32-make install

Next tutorial

You are now ready to see the next Tutorial: How to create and build a CMake project that uses ViSP on Unix or Windows that will show you how to use ViSP as a 3rd party to build your own project.