Vistual Studio: First steps

Goals

  1. Compile and run cocos2d-x tests on the emulator
  2. Set a breakpoint in Visual Studio.

Running cpp-test on the Emulator

1. Download cocos2d-x v3.0

2. Unzip it and then go to cocos2d-x/build directory

$ cd cocos2d-x/build

3. Open cocos2d-wp8.vc2012.sln with Visual Studio

$ start cocos2d-wp8.vc2012.sln

4. Set cpp-tests (Windows Phone Silverlight 8) as the default project:

  • Go to the Solution Explorer
  • Right click on cpp-tests (Windows Phone Silverlight 8)
  • Click on Set as StartUp Project

vs_default_project

5. Run cpp-tests on the Emulator

  • Press the Emulator 8.1 WVGA 4 inch button

run-emulator

6. If the following Dialog pops-up, just press Retry:

hypervisor

And that’s all. You should see the cpp-tests running on the Emulator:

cocos2d-emulator

Setting a breakpoint

  1. Open any file, like ActionsTest.cpp. Tip: Quick Open file  is  Ctrl + ,
  2. Set a breakpoint in any line, by clicking on the left margin, like in Xcode
  3. You should see a red dot (like in Xcode).

But if you run cpp-tests, you will see that the red dot is no longer red: it is white now.

breakpoint-bad-visual-studio

The problem is that by default, cpp-tests is treated as a Managed Task by the debugger. You have to change it to Native:

  1. Go to Solution Explorer
  2. Right click on cpp-tests (Windows Phone Silverlight 8)
  3. Go to Properties -> Debug
  4. And change UI Task and Agent Task to Native Only

native-only-task

Done! you should be able to set breakpoints on your C++ code now!

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