Home :: Updates :: Player Screenshots :: Editor Screenshots :: Documentation

Compiling the Player Under Windows

Compiling the player is actually much easier than tackling the editor. All of the needed libraries can be downloaded with binaries, so it's all a cakewalk.
Table of Contents

  1. The Basics: SDL
  2. SDL_image
  3. SDL_mixer
  4. SDL_ttf
  5. Last One: SDL_gfx
  6. Setting Up MSVC

The Basics: SDL

SDL is the graphics library that forms the backbone of the player. Conveniently, SDL can be downloaded and easily included in the build. First, go to the download page, and scroll down to the section listed as Development Libraries. Under Win32, surprise, you'll see a release for MSVC 8, which you should get. For me, it was SDL-devel-1.2.13-VC8.zip. Download it, extract, and place the includes and libs in the correct folders in your MSVC installation.


SDL_image is a popular "add-on" library to SDL that provides support for a ton of image formats other than lame BMPs. In other words, it's indispensable. The official website is here, and you should grab the VC8 devel release under Win32. Once again, download, extract, and move the files accordingly.


For all your sound needs, this library provides an easy interface to get things done. Head over to the SDL_mixer website, and grab the VC8 development release. I downloaded version 1.2.8, but you should get the latest. Follow the same procedure as above.


This is starting to get repetitive, eh? SDL_ttf provides the TrueType font rendering routines, and as you may have guessed, text is a big part of the game. The website for this library is here, and just fetch whatever is the latest VC8 development release (for me, it was 2.0.9). I think you know what to do from here. ;)

Last One: SDL_gfx

Phew, I bet you're sick of all of these little add-ons. Well, the good news is that this is the final one that you'll need to get. However, you'll notice that there is no release for MSVC on the website! Instead, there is only an older version, and the latest release comes in the form of source code. Luckily, compiling SDL_gfx was a piece of cake, and you can get my compiled variant from here. Now just place the files as usual.

Setting Up MSVC

Now the easy part. Before you can start compiling, you need to set up the correct include paths. The only thing that actually needs to be configured, is glibmm. If you recall, the player now uses Unicode strings, and glibmm provides those. If you already have read the editor's compiling guide, then you'll probably know the next part. Even if you didn't, I explain what to do in detail regardless.

First, we need to do one, small configuration step. We need to add an environment variable to your system, so right click My Computer, open the Advanced tab, and click the Environment Variables button on the bottom. In the System Variables frame, click New. In the dialog that just popped up, type in PKG_CONFIG_PATH for Variable Name. Now, assuming you installed GTK to C:\GTK, type in C:\GTK\lib\pkgconfig for the Variable Value field. Click OK and exit out of the dialogs. You now need to open up a command prompt window, and change into where you installed GTK, and then into the bin folder there. Once there, execute this command without the quotes:
"pkg-config.exe gtkmm-2.4 --cflags"

If everything went right, pkg-config will spit a bunch of paths. You should copy those (right click, Mark, select the text, Enter), and paste them into a blank Notepad document. The paths will be broken down into a few lines, so make sure everything is on one line in your Notepad. Now, replace all of those forward slashes with backward slashes (protip: Edit -> Replace *gasp*), and you should have a list of include paths. Make your compiler aware of them.

Usually, with includes come libraries that the linker needs. Luckily, pkg-config has all the answers. Repeat what you did above, except now, instead of running that other command, try this one: "pkg-config glibmm-2.4 --libs"

Once again, copy and paste that output into Notepad, and tidy it up. The output should contain many -lxxx bits. What you should do is to take each -lxxx, remove the prefix (-l), and add a .lib extension to the end. So, let's say we have: -lglibmm-2.4. You would change that to: glibmm-2.4.lib. Why all this extra effort? This is because pkg-config assumes you're using gcc (which takes linker libraries in that format), but since we're using MSVC, we need to be careful to pass the right arguments.

This is what my linker dependencies looked like:


With that, glibmm is out of the way. Now just add the remaining libraries:


With this, the compiler should now have everything it needs. The only piece of the puzzle is to add a preprocessor define. Since we're compiling on Windows, certain code needs to be included in the build. This is done by defining __WIN32__.

And that is all. You should now try compiling the project, and if all goes well, you should end up with a finished executable. However, before you can fire it up and start playing around, you need to throw in the data.dpkg resource file (found in CVS), along with the arial.ttf font file (also in CVS). Finally, you'll need to add in the missing DLLs, which can all be found on your system assuming you copied all of those library files correctly. More than likely, they'll be in your MSVC/bin folder.

Of course, no matter how much time I spent writing this guide, there is a good chance I missed something. If you are stuck somewhere along the line, or if you run into errors, please let me know so I can fix the documentation. As always, feel free to contact me.

Good luck. :)

Hosted on Sourceforge.net. All Phoenix Wright trademarks and other property are copyright Capcom.