From OpenStreetMap Wiki
Jump to: navigation, search

Building and running libosmscout under Windows

Tested using

  • Visual Studio Community 2013 Update 4
  • Qt 5.5.0 for Windows 32-bit (VS 2013)
  • Windows 7 SP1

Debug Configuration


This is a base library for everything else.

  • Download a source code snapshot from
  • Move .vcxproj files and include folders from libosmscout-code\windows\xxx to upper level project directories libosmscout-code\xxx (xxx = Import, libosmscout, libosmscout-import, etc.). Rename the project files, cutting off msvc2013_ prefixes.
  • Edit msvc2015_libosmscout.sln to correct the path to libosmscout.vcxproj and open the solution.
  • Open Project properties and select All Configurations in the Configuration drop box. This will make our changes apply to both Debug and Release configurations. In the tree below, go to Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions, and add
  • Delete Reference.cpp from project
  • At the top of Progress.h file, add:
#include <stdint.h>
  • Build project


This is a library required by the Import application.

  • Add preprocessor definition
  • Download libxml2, iconv and zlib windows binaries from Copy include files to libosmscout-import\include, copy libxml2.lib to libosmscout-import\lib
  • Go to Project properties > Configuration Properties > Linker > Input > Additional Dependencies and add
  • Place the libxml2.dll, iconv.dll and zlib1.dll to output folder or any PATH folder like C:\Windows
  • Build project


This is a tool to convert .osm XML files to indexed binary format. Note that some data is going to be dropped in conversion process. Libosmscout is mobile device oriented, so it keeps data size to miniumum. You can play around with the .ost file to import different objects if you want to. This project should build without problems. To use it, find an .osm data file to import from. After that, run

import --typefile ..\..\stylesheets\map.ost --destinationDirectory yourdatafolder yourmapfile.osm
  • Don't download .osm data directly using Export button - resulting files don't have node id's sorted and the library will report import error. There should be links below to get sorted data from overpass or geofabrik.
  • Don't set destination to a nonexistent directory. Create it manually first.
  • In a debug build, there will be quite a bit of "debug assertion failed" messages. Press ignore, multiple times - or build release version.


This is a base renderer interface, used by specific renderer implementations like libosmscout-map-qt.

  • Add preprocessor definition
  • Build project.


This library is a qt-based renderer used by OSMScout2. There are other renderers available for different applications.

  • Go to and download Qt for Windows 32-bit (VS 2013). Qt Creator comes with that download, so I'll be using it instead of Visual Studio.
  • Copy include\ to MapQtFeatures.h
  • Add following lines at the top of MapPainterQt.h
#if defined(WIN32)
    #include <BaseTsd.h>
    typedef SSIZE_T ssize_t;
  • Open project with Qt Creator and build.

If you edit project file while it's open in Creator, right click the project and Run QMake to apply changes.


This demo application displays data which was prepared earlier using Import tool. The appearance of the map is controlled by the .oss file.

  • No configuration here, just Build project
  • If you run OSMScout standalone executable, it starts a process but doesn't show any window. To fix that, add C:\Qt\Qt5.5.0\5.5\msvc2013\bin to your PATH environment variable.
  • Arguments are not passed to application so you have to put imported data files and stylesheets\standard.oss into your executable folder. To fix that, comment out WinMain callback at the very bottom of OSMScout.cpp.
//int CALLBACK WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/){
//	main(0, NULL);

After that, run with parameters:

osmscout yourdatafolder ../../stylesheets/standard.oss ../../libosmscout/data/icons/14x14/standard/

Release Configuration

Following steps assume you have already built the Debug versions.


This library is required for Release version of libosmscout.

#include <functional>
  •, add
#include <algorithm>
  • Build solution


  • Go to Project Properties > Configuration Properties > C/C++ > General > Additional Include Directories, switch Configuration to Release and add
  • Copy marisa headers to include folder
  • Copy compiled libmarisa.lib to lib\libmarisa.lib and link
  • Exclude tests from build
  • Build project


  • Add Include Directories for Release Configuration
  • Build project


  • Add Include Directories for Release Configuration
  • Build project


  • Add Include Directories for Release Configuration
  • Build project


  • Build project


  • Remove debug from CONFIG += line in project file
  • Right click project > Run QMake
  • Build project