Skip to content

Building with Visual Studio

Tommaso Checchi edited this page Jul 9, 2014 · 1 revision

Visual Studio is often my IDE of choice and this makes it (probably) the most straightforward platform to set up... if you have Visual Studio 2012!
Caution May contain C++11 - you will need http://www.microsoft.com/visualstudio/eng/downloads#d-2012-express, http://www.microsoft.com/visualstudio/eng/visual-studio-update or above to build using the prebuilt dependencies, due to CRT conflicts, and at least the plain VC2012 to support the C++11 features.

1. Building Dojo

You can skip this step if you're using a Monthly builds.

  • First thing, clone or download the dojo repo into a folder on your pc, that we'll call just "dojo" from now on
  • Open dojo/dojo.vcxproj with VS2012
  • Manually build each profile you need, or select Build > Batch Build to quickly rebuild both Debug and Release.
    DebugOptimized is a special build which keeps asserts, logging and console enabled but is optimized fully, useful to catch Release-only issues.
    The libs should land in dojo/lib, ready to be used!

2. Setting up your project

Turns out that this too is very simple, as in VisualStudio-simple;
just follow carefully these steps:

  • Create a new Console/Win32 project, or an Empty one if you like to live dangerously
  • Fire up Project properties
    • In the General tab: Change Platform Toolset to v110_xp - this is very important! If you don't see this option, you need to install the Update 1
    • In the C/C++ tab:
      • add "dojo/include; dojo/dependencies-win32/include" to the "Additional Include Directories" field
    • In the Linker tab
      • add "dojo/lib; dojo/dependencies-win32/lib" to the "Additional Library Directories"
      • add either "dojo_d.lib" or "dojo.lib" to your "Additional Dependencies" field
    • then, remember to copy the .dlls from bin to your working directory... Dojo is a static library but some of its dependencies aren't - if you have hints on how to statically link those, tell me!

3. Include and build

#include <dojo.h>

it's a good idea to add the include to a precompiled header to speed up building, and don't forget to use "namespace Dojo"!

You can check if you set up everything correctly with a simple main.cpp like this one, which just instances and then kills Dojo:

#include <dojo.h>
using namespace Dojo;

int main( int argc, char** argv )
{
	Platform::create();	
	Platform::shutdownPlatform();
	
	return 0;
}

At this point, you should hopefully have a project that compiles, runs, and closes itself right after opening.

4. Using dojo

The mostly uninteresting stuff that goes on between create() and shutdown() is covered in the next tutorial,
Placing a ninja on screen, from scratch!

Clone this wiki locally