WP8.1 Universal cpp-tests Build Failure

I am using VS Express 2013 SP2 for Windows… have used VS Express 2013 SP2 for Windows and Cocos2d-x 3.1 to publish games successfully in the past. My OS is Windows 8.1 Pro in Parallels.

Now I am trying to use VS Express 2013 SP2 for Windows with Cocos2d.x 3.6, and the cpp-tests will not build.

When I attempt to build the tests following the instructions from the Programmers Guide (build/cocos2d-win8.1-universal.sln) or when I create a new project using the cocos console and then open the proj.win8.1-universal/AppName.sln and build, for both the cpp-tests and the newly created app, I get the same build errors.

For Windows 8.1 I get errors relating to WinSock2.h not being found.
In various files, the #include <WinSock2.h> cannot be resolved.

For WindowsPhone 8.1 I get linking errors relating to KeyBoardWinRT.

When building cpp-tests.Windows I get the following errors:

Error	3	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory (X:\Tools\Cocos2d-x\cocos2d-x-3.6\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\..\..\spine-cocos2dx.cpp)	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	libSpine.Windows

Error	2	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory (X:\Tools\Cocos2d-x\cocos2d-x-3.6\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\..\..\SkeletonRenderer.cpp)	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	libSpine.Windows

Error	4	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory (X:\Tools\Cocos2d-x\cocos2d-x-3.6\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\..\..\SkeletonAnimation.cpp)	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	libSpine.Windows

Error	1	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory (X:\Tools\Cocos2d-x\cocos2d-x-3.6\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\..\..\PolygonBatch.cpp)	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	libSpine.Windows

Error	5	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	libcocos2d_8_1.Windows

Error	6	error C1083: Cannot open include file: 'WinSock2.h': No such file or directory	x:\tools\cocos2d-x\cocos2d-x-3.6\cocos\base\CCConsole.h	31	1	cpp-tests.Windows

When building cpp-tests.WindowsPhone I get the following errors:

Error	3	error LNK2019: unresolved external symbol "public: __cdecl cocos2d::KeyBoardWinRT::~KeyBoardWinRT(void)" (??1KeyBoardWinRT@cocos2d@@Q$AAA@XZ) referenced in function "public: virtual void __cdecl cocos2d::KeyBoardWinRT::[Platform::IDisposable]::<Dispose>(void)" (?<Dispose>@?QIDisposable@Platform@@KeyBoardWinRT@cocos2d@@U$AAAXXZ)	X:\Tools\Cocos2d-x\cocos2d-x-3.6\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\pch.obj	cpp-tests.WindowsPhone

Error	2	error LNK2001: unresolved external symbol "public: __cdecl cocos2d::KeyBoardWinRT::~KeyBoardWinRT(void)" (??1KeyBoardWinRT@cocos2d@@Q$AAA@XZ)	X:\Tools\Cocos2d-x\cocos2d-x-3.6\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\libSpine.WindowsPhone.lib(spine-cocos2dx.obj)	cpp-tests.WindowsPhone

Error	4	error LNK2001: unresolved external symbol "public: __cdecl cocos2d::KeyBoardWinRT::~KeyBoardWinRT(void)" (??1KeyBoardWinRT@cocos2d@@Q$AAA@XZ)	X:\Tools\Cocos2d-x\cocos2d-x-3.6\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\libSpine.WindowsPhone.lib(SkeletonRenderer.obj)	cpp-tests.WindowsPhone

Error	5	error LNK2001: unresolved external symbol "public: __cdecl cocos2d::KeyBoardWinRT::~KeyBoardWinRT(void)" (??1KeyBoardWinRT@cocos2d@@Q$AAA@XZ)	X:\Tools\Cocos2d-x\cocos2d-x-3.6\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\libSpine.WindowsPhone.lib(SkeletonAnimation.obj)	cpp-tests.WindowsPhone

Error	6	error LNK2001: unresolved external symbol "public: __cdecl cocos2d::KeyBoardWinRT::~KeyBoardWinRT(void)" (??1KeyBoardWinRT@cocos2d@@Q$AAA@XZ)	X:\Tools\Cocos2d-x\cocos2d-x-3.6\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\libSpine.WindowsPhone.lib(PolygonBatch.obj)	cpp-tests.WindowsPhone

Error	7	error LNK1120: 1 unresolved externals	X:\Tools\Cocos2d-x\cocos2d-x-3.6\build\ARM\Debug\cpp-tests.WindowsPhone\cpp-tests.WindowsPhone.exe	1	1	cpp-tests.WindowsPhone

Any idea what might be causing the builds to fail?

Get the latest version from Github.
I can confirm it builds properly.

I tried getting the latest v3 from github, executed download dependancies and updated the submodules… but I still was getting the winsock.h errors for cpp-tests.Windows.

The issue seemed to be some thing flakey going on with Visual Studio, NOT with cocos2d-x.
Chandan Thakur had the same issue I was having and posted it here a while back.
https://msopentech.com/blog/2014/10/27/cocos2d-x-now-supporting-windows-universal-apps/

The following is what I did to get it working.

Needed Update 4 for Visual Studio
The reason I was getting the winsock.h errors is because I was using VS 2013 Express with Update 2.

According to stammen at the following link, winsock.h is not available until VS 2013 Express Update 3 or 4.
https://github.com/cocos2d/cocos2d-x/issues/9320
So I changed to VS 2013 Community Edition with Update 4, as recommended by MSOpenTech http://msopentech.github.io/cocos2d-x/.
I missed it, but the cocos2d-x repo readme also says to ensure that you have VS update 4.

fd_set errors
But now instead of the winsock.h errors, I now had errors from CCConsole.h on line 138 with the code:
fd_set _read_set;
Several errors, this is one of them:
error C2146: syntax error : missing ‘;’ before identifier ‘_read_set’

To fix the fd_set not being defined issue was to execute the repair of VS 2013 Community. I had successfully installed it only 15 minutes before This is the fix recommended by garrettshearer at this link:

https://github.com/cocos2d/cocos2d-x/issues/9320

Uninstalled KB2976978 per MSOpenTech Recommendation
Based on the msopentech Installing Cocos2d-x On Windows Article: http://msopentech.github.io/cocos2d-x/
I removed (KB2976978) breaks the Windows App Certification (WACK) Test for the Windows Store App in the Cocos2d-x v3.3 Universal App. The update causes the Supported API test to fail with a lot of errors.
Uninstall update KB2976978
I am not certain the uninstall of KB2976978 was necessary.

Registration of the app failed when trying to deploy cpp-tests.Windows
Now the app built without errors, but there was a Deployment Registration Issue.
I am using Parallels on Mac to run Win 8.1 Pro.
The source code is on my Mac file system and it is shared in Parallels via a virtual “network drive”. In reality the solid state drive that my Mac is installed on is also the location of the virtual win 8.1 pro.

This article has info about how to get a Win32 to deploy and fix the deployment registration issue.
https://social.msdn.microsoft.com/Forums/windowsapps/en-US/3fc1f3cf-2d8b-4dee-a348-40d0bf2c3c66/rejecting-request-to-register-from-file-when-deploying?forum=winappswithhtml5

I changed to remote debugging and added localhost as the remote debugger in the project properties of cpp-tests.Windows. This enabled me to launch the windows app in my Parallels virtual machine.
Error 1 Error : DEP0700 : Registration of the app failed. Rejecting a request to register from X:\cocos2d\build\Debug\cpp-tests.Windows\AppX\AppxManifest.xml because the files are on a network share. Copy the files to the local computer before registering the package. (0x80073cf9) cpp-tests.Windows

To Run on an ARM Device
Now the ARM build is working too in VS 2013 Community.
I was getting a Hypervisor Issue that would not allow me to run in the simulator.
Not sure how to fix this for Parallels. I do have 8.1 Pro though and I do have Enable Adaptive Hypervisor checked in the Parallels Optimization. There must be something else needed to get the simulator to work.

But I am now able now, with VS 2013 Community Edition, to build and run on an ARM device Lumina 928W.

My headache of getting the cpp-tests to run on windows is now relieved.

bcdedit /set hypervisorlaunchtype on (or auto start)
solved my hypervisor issues for the emulator.

I rebooted my windows VM and was going to try your fix, but before I did I opened VS 2013 Community and noticed that I had various Emulator 8.1 emulators to choose from in the run app play button. Previously I just had a play button that I think said simulator or emulator.

Now I can select various Emulators for win32 and x64 to run cpp-tests.WindowsPhone and they run without error.

Is there no emulator for Arm in VS?

I was having the “project on a network share” issue in Parallels again for a new App.Windows project of Win32 under the universal proj.win8.1-universal project.

This time for some reason the Project Settings -> Debugging -> Machine Name field was not showing up for the Win32 platform.

But after changing the build from remote to local and back to remote (drop down next to the play button to run the project) then the Machine Name appeared for Win32 -> Debugging config and I was able to add localhost to that field and the Win32 build would run ok in a Win10 parallels environment with VS 2013 Community.