Setting everything up – Part 2

If you haven’t gone through Setting everything up – Part 1, do that now (I’ll wait) so that everything here will make sense.

Step 4 – Installing Box2D:  In order to get Box2D to play well with Visual Studio, you need to go through a few steps, which are relatively painless.  In order to get it working, I originally followed the steps presented by aneelkkhatri, here.  However, there are a few modifications that need to be done. So, for the sake of completeness, I’m going to go over it all:

  1. The latest release at the time of this writing for Box2D is 2.2.1, and it comes with a premade Visual Studio 2010 solution, so there is no need to download cmake.  Instead, just open Visual Studio and navigate to the Box2D directory and go into the Build\vs2010\ directory and open the Box2D.sln solution file.  Note for VS2012 users: You may get prompted saying that this solution was made with an old version of VS and ask if you want to update, I would suggest clicking Don’t Update.part2-1
  2. Once you have the solution loaded, you will see there are five projects: Box2D, FreeGLUT, GLUI, HelloWorld, and Testbed.  We only need to concern ourselves with the Box2D project, so go ahead and right-click on that and choose “Build.”  (This ends the ‘one-time-only’ portion of the setup, and from this point on, you will need to do the remaining steps every time you start a new project.)part2-2
  3. Once that is built you can close down this solution and we are now going to start our first demo.  Don’t Panic!  This will be pretty simple, just so that we can ensure everything is installed correctly and working J  So, let’s go to File>New Project.  Choose Visual C++ and select Empty Project.  Now just give it a name, I’m going to call mine Box2D_SFML_Test. part2-3
  4. Once our solution is created, right click on the Box2D_SFML_Test project and choose “Open folder in File Explorer”part2-4 Now we are going to create a folder named ‘lib’part2-5
  5. Once that is created, we’re going to copy the Box2D.lib and box2d.pdb files that we just built from the included solution into our new lib folder (They should be in [Box2D]\Build\vs2010\bin\Debug)   part2-6
  6. Now, from our Box2D extract directory (the same directory as \Build\), we’re going to copy Box2D into our new project’s folder: part2-7part2-8We do this because there are some additional header files within this Box2D folder that we will need later on.
  7. Now, we need to go into our project’s Properties and do some configuration.  So right-click on the project Box2D_SFML_Test>Properties. part2-9Under Configuration Properties>C/C++>General, we’re going to set Additional Include Directories to “./”part2-10
  8. Then under Configuration Properties>Linker>General, change Additional Library Directories to “./lib” part2-11Still under Linker, but this time Linker>Input, click the values for Additional Dependencies, and click the drop-down arrow and choose “edit…”  Now enter “Box2D.lib” and hit OK.  And then Apply to the Properties window.  part2-12That will end setting up Box2D, next time we’ll look at how to install SFML
Advertisements
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s