Recent Changes - Search:





Wiki Stuff

edit SideBar

Building PTLib on Windows


  1. Introduction
  2. Prerequisites
  3. Download and install the PTLib source code
  4. Open the solution file
  5. Install optional packages
  6. Build the PTLIB Static project
  7. Build the PTLIB DLL project
  8. Tailoring the configure search path


This document provides instructions building PTLib with Visual Studio on Windows.

Note that older compilers and operating systems are rarely checked, they may work, they may not.


You will need the following:

  • Visual Studio 2017 Express or Professional Editions.
  • There are a number of optional downloads for extra features, for example OpenSSL. PTLib will automatically detect if these are installed and compile the system accordingly.

3. Download and install the PTLib source code

If using Visual Studio 2017, you can use Team Explorer to clone the git repository git://

Alternatively, you can download and extract the PTLib source code. For the purposes of this document, the directory that contains PTLib will be indicated as installdir\PTLib

The PTLib source may be downloaded as a ZIP file from the SourceForge download page or you may download it using Subversion

Open the ptlib_2017.sln solution file

The solution contains the following projects:

  • configure
  • Hello World DLL
  • MergeSym
  • PTLib DLL
  • PTLib Static

There is also PTLib_samples_2017.sln which contains the base library and many samples/test applications.

Both 32 and 64 builds are available in the solutions.

Install optional packages

The PTLib build process will automatically detect many packages that are installed on the host system. Before starting the build process, select and install the packages from the list below that are needed:

  • OpenSSL - Provides support for encryption and authentication. We recommend using a pre-packaged binary distribution such as the one available from Shining Light Productions. Note only v1.0 is currently supported, do not use v1.1.
  • Expat - Provides support for XML. This library must be available if Voice XML (VXML) and XMPP functions are required. For 32 bit builds, we recommend using a pre-packaged binary such as the ones available from the Expat SourceForge site. For 64 bit builds you will have to build from source at Clone it to installdir\expat, and after creating the new x86 platform, make sure it outputs the lib to .\..\win32\bin64\$(Configuration)\. Note, there are a large number of places this needs to be adjusted.
  • OpenLDAP - Provides support for the LDAP protocol as used by ILS and other network services. OpenLDAP requires OpenSSL to be installed. Detailed build instructions for OpenLDAP can be found here, or you can use use these precompiled binaries
  • FFMPEG - Provides support for audio/video files.
  • libjpeg - Provides for support for using static JPEG images as video source. Source code, and precompiled binaries for Windows are available
  • Lua - Provides for support for using Lua scripting language. These are expected to be in one of several directories, e.g. ..\external\Lua-win32 and ..\external\Lua-win64. The binaries provided here are annoying in that the 32 bit and 64 bit versions are named identically. It is thus difficult to be able to use both on a development machine at the same time as you cannot simply put the DLL in your path. You need to explicitly place the correct one in the PATH via the "Debug/Evironment" Option in Visual Studio.
  • For Windows 8 - Microsoft Windows Software Development Kit - Needed for features such as IPV6 and DNS resolver support.

Build the PTLib Static project

Build the PTLib Static project to create a static code library containing all of the PTLib code. In Release mode, this will build the ptlibs.lib file. In Debug mode, this will build the ptlibsd.lib file.

Note that the first step of the build is the execution of the configure program which searches for optional components that may be installed on the host system.

IMPORTANT TIP: If configure finds options in directories not belonging to other compilers, such as Cygwin, MSys, MSVC 6, or the wrong version of, then please read section 10 "Tailoring the configure search path" below on how to tailor the configure search path

Build the PTLib DLL project

Build the PTLib DLL project to create a DLL code library containing all of the PTLib code. In Release mode, this will build the ptlib.dll file. In Debug mode, this will build the ptlibd.dll file.

NOTE: the Release version of the MergeSym project must be built *before* building PTLib DLL. Generally this will happen automatically through the solution dependencies, however if this does not occur and you get an error such as:

    'MergeSym' is not recognized as an internal or external command, operable program or batch file.

then right click on MergeSym project and build it manually.

Tailoring the configure search path

Occasionally, configure will incorrectly identify the location of installed packages, leading to compilation problems.

The most common reason is having multiple versions of Visual Studio installed at the same time, or using Cygwin headers, or using libraries from the Windows Mobile version of Visual Studio.

If you have compilation errors, check the .../ptlib/include/ptbuildopts.h file and look for where there are lines starting with #pragma include_alias(), the path included in that command should look sensible.

This problem is solved by setting environment variable VSNET2010_PTLIB_CONFIGURE_EXCLUDE_DIRS to identify paths that should not be searched.

Edit - History - Print - Recent Changes - Search
Page last modified on December 16, 2018, at 10:08 PM