Skip to content

Developer Getting Started: Visual Studio

Cong edited this page Jan 30, 2014 · 35 revisions

Warning: using these instructions will not create a binary that is compatible with Windows XP! For releases, please follow the [MinGW](Developer Getting Started: MinGW) instructions.

Prerequisites

Clone repo: GitHub for Windows

Instructions for TortoiseGit are also available; these are not recommended

  1. Optional: for the purposes of this walkthrough, the clone location is C:\cdogs-sdl. To make GitHub for Windows automatically clone to this location, set the default storage directory to C:\.

  2. Click the "Clone in Windows" button in the repo website.

  3. You should now see the repo contents in C:\cdogs-sdl

Install SDL/SDL_mixer development libraries

There are many instructions for installing SDL for visual studio, but unfortunately CMake's Windows SDL support is quite poor, so these instructions are designed to support CMake as well.

  1. Choose a location for the SDL libraries (e.g. C:\dev).

  2. Copy the contents of the SDL_1.2.XX subfolder to C:\dev (so you should have the folders C:\dev\include, C:\dev\lib etc.)

  3. Do the same for SDL_mixer and SDL_image, combining the contents of the include and lib folders. However, you should also copy the contents of those folders to C:\dev for CMake's benefit (just SDL_mixer.h and SDL_mixer.lib for SDL_mixer).

  4. In C:\dev\lib, there are x86 and x64 versions of the same libraries. Copy the .lib files in x86 to the lib folder.

  5. Copy the .dll files to the C:\cdogs-sdl\src folder

  6. Create an environment variable SDLDIR that points to C:\dev

Run CMake

  1. Run CMake: for "Where is the source code:" and "Where to build the binaries:" input C:\cdogs-sdl

  2. Click "Configure", choosing the right Visual Studio version (e.g. VS2012 is VS11); click Finish

  3. Click "Generate"; you should now see Visual Studio projects in C:\cdogs-sdl.

Visual Studio

  1. Open C:\cdogs-sdl\cdogs-sdl.sln

  2. Set the cdogs-sdl project as the startup project

  3. Press F5 to compile and run. You are ready to go!