Cannot run Windows executable of cocos2d-js game compiled with Visual Studio

I cannot run a Windows executable of my cocos2d-js game. Here I show you the steps I follow:

  • Have Visual Studio Express 2015 C++ installed
  • Get cocos2d 3.8 full version from http://www.cocos2d-x.org/download
  • Install it with the python setup
  • Use cocos new GAME -l js

From this point, I have tried two different approaches. The first one is using the cocos console:

  • Go cd GAME
  • Call cocos compile -p WIN32
  • After several minutes, the build fails saying fatal error RC1015: cannot open include file 'afxres.h'. [GAME\frameworks\runtime-src\proj.win32\GAME.vcxproj]
  • I have found that the answer to solve this particular failure is here: 3.0rc1: cannot open include file ‘afxres.h’ in VS2013 Express which basically involves commenting out the include "afxres.h and then adding #include "WinResrc.h" and #define IDC_STATIC -1 in the game.rc file.
  • Now once again I use cocos compile -p WIN32
  • Build is successful!
  • Let’s try cocos run -p WIN32
  • And we get…

enter image description here

It just doesn’t work.


The other approach is literally opening the Visual Studio project in the proj.win32 folder and running it from there. It will give you the same afxres.h error. You fix it and then when the build is successful and you run the game you get this:

Exception thrown at 0x554DDB7F (libcocos2d.dll) in GAME.exe:
0xC0000005: Access violation reading location 0x00000200.

If you try to “continue” ignoring the error, you will be stuck with

Unhandled exception at 0x7744017E (ntdll.dll) in GAME.exe: 0x00000000:
The operation completed successfully.


So, I imagine that both approaches are exactly the same: Visual Studio can successfully build the project, but something (apparently inside libcocos2d.dll) is making it crash.

What am I doing wrong?

I am using Windows 7 Home. I happen to be running it in Parallels Desktop in Mac (I don’t have a real windows machine at the moment). Not sure if that even matters.

Fixed. Just had to install Parallels Tools.