Compiling PtokaX on Windows

Posted on
  • Visual Studio 2010
  • Optional: Windows SDK 7.1a x86 (download, 500mb iso)


PPK’s official PtokaX builds are compiled with the 7.1 SDK. The Windows SDKs are intermittent updates to the headers, libraries and compilers shipped with Visual Studio - PtokaX doesn’t use any cutting-edge windows features, so unless you already have the SDK for other reasons, it is more convenient to swap out the Platform Toolset in the PtokaX project (Configuration Properties > General) and set it instead to v100 (the VS2010 compiler).

PtokaX is licensed to you (yes, you!) under the GPL - that means, legally, if you distribute your PtokaX.exe to someone, they have to have access to the source code. That of course doesn’t need to extend to all your hub users.

Building libraries




PPK has made some patches to lua himself, this could have been a nightmare to build but he thankfully provides his sources with VS2010 projects along with prebuilt libs.

The pre-built library is dynamic, so linking against the .lib means your generated .exe will rely on PXLua.dll. If this is unacceptable for any reason, you could alternatively include all the lua source files within the PtokaX project and build them alongside the main source code.


  • Author provides a VS2010 project
  • Unpack, solution is in zlib/contrib/vstudio/vc10/zlibvc.sln
  • Change the configuration to ReleaseWithoutAsm, and Build All.
  • Verify that zlib-1.2/contrib/vc10/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib exists with size ~600kb


It’s also possible to build zlib in release mode with assembly optimisations if you set up MASM and follow the instructions. “Stat” means statically-linked - the alternative is having your compiled PtokaX EXE rely on a zlib.dll. In this case it’s not much of a big deal.

Building PtokaX

Get PtokaX source code from svn://

Not used to svn? A mirror of r84 is here temporarily: (…)


The project comes with three configurations defined: Debug, Release and Testing. Debug is broken in some interesting ways - not least of all some errors preventing build, so PPK obviously doesn’t use that much. Ordinarily we would get debug builds working first, but in light of this, let’s aim straight for the Release build.

  • PtokaX-gui.sln
  • Change the configuration to Release
  • Open Ptokax-gui project properties
  • Configuration Properties > General > VC++ Directories
  • For Include Directories: add the path to /zlib-1.2 (containing zlib.h), add the path to /tinyxml (containing tinyxml.h), add the path to PXLua/src (containing lua.h)
  • For Library Directories: add the path to /zlib-1.2/contrib/vc10/x86/ZlibStatReleaseWithoutAsm (containing zlibstat.lib), add the path to /tinyxml/Release (containing tinyxml.lib), add the path to PXLua (containing PXLua.lib)
  • Configuration Properties > Linker > Input > Additional Dependencies
  • Replace zlib.lib with zlibstat.lib
  • Configuration Properties > C / C++ > Preprocessor > Preprocessor Definitions
  • Add ZLIB_WINAPI; to definitions (reason)
  • Build All
  • PtokaX.exe and PtokaX.pdb are generated in /ptokax/compiled

To use: Copy PXLua.dll from /pxlua to the same directory as PtokaX.exe.


A .pdb file contains only debugging information, you can discard it to save space. But it might be helpful if you plan on making any changes to PtokaX, especially since we’ve built everything in release mode (so the .exe itself doesn’t contain any debugging information)