I've been going at this problem for almost a week now and I still have 700+ errors. Definitely need all your help! Thanks.
Problem: Need to use
Cocos2dx for Windows Phone 8
in my C++/DirectX Visual Studio 2012 project that also uses C#/XAML UI.
Given: Cocos2dx-wp8 as an Application .exe project downloaded from http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download
Solution:
- Open my C#/XAML/DirectX Game1 solution .sln project in Visual Studio 2012.
- Right click on solution in Solution Explorer. Add --> Existing Project...
- Selected: \cocos2dx-0.13.0-wp8-0.8\HelloWorld\cocos2d.vcxproj and clicked open
- Renamed the HelloWorld project to something else like "Cocos2dxWp8" and delete the HelloWorld Classes folder and all the Assets you don't want (like the squirrels and background images)
Click Properties --> Configuration Properties --> General --> Configuration Type --> from "Application (.exe) change to "Dynamic Library (.dll)"
Added new paths to Properties --> C/C++ --> Additional Include Directories -->
$(ProjectDir); $(IntermediateOutputPath); ..\cocos2dx\include; ..\cocos2dx; ..\cocos2dx\platform\third_party\win8_metro\libpng; ..\cocos2dx\platform\third_party\win8_metro\zlib; ..\cocos2dx\platform\third_party\win8_metro; ....\Cocos2dxWp8; ..\cocos2dx\platform\win8_metro; ..\cocos2dx\platform\third_party\win8_metro\freetype; ..\cocos2dx\platform\third_party\win8_metro\libjpeg; ..\CocosDenshion\include; ..\cocos2dx\platform; inc; %(AdditionalIncludeDirectories)
- Updated the paths in Properties --> Linker --> Input --> Additional Dependencies -->
..\cocos2dx\platform\third_party\win8_metro\libraries\x86\freetype.lib; ..\cocos2dx\platform\third_party\win8_metro\libraries\x86\zlib.lib; ..\cocos2dx\platform\third_party\win8_metro\libraries\x86\libjpeg.lib; ..\cocos2dx\platform\third_party\win8_metro\libraries\x86\libpng.lib; dxguid.lib;xaudio2.lib;dxgi.lib;uuid.lib;d3d11.lib;%(AdditionalDependencies)
- Updated paths in VC++ Directories:
$(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\freetype; $(SolutionDir); $(ProjectDir)inc; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\CocosDenshion\include; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\zlib; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\libraries; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\libpng; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\libjpeg; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\libxml2; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\third_party\win8_metro\; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform\win8_metro; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\platform; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx\include; $(SolutionDir)GameWp8Dx\Cocos2dxWp8\cocos2dx; $(IncludePath)
From here, it builds successfully! It outputs a .dll file but no .lib file, so...
In CCPlatformMacros.h, I enabled exporting classes to dll:
#define CC_DLL __declspec(dllexport)
Yah, .lib is being written to then...
715 Errors, 772 Warnings
Error 773 error LNK2001: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadHandler::~CCKeypadHandler(void)" (??1CCKeypadHandler@cocos2d@UAE@XZ) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCSpriteBatchNode.obj Cocos2dXWp8Framework Error 774 error LNK2001: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadHandler::~CCKeypadHandler(void)" (??1CCKeypadHandler@cocos2d@UAE@XZ)
I've included the header file for where CCKeyHandler class is defined (inside CCKeypadDelegate.h) and CCSpriteBatchNode.h is also in the same include folder.
Class signatures look like this:
class CC_DLL CCKeypadHandler : public CCObject
class CC_DLL CCSpriteBatchNode : public CCNode, public CCTextureProtocol
Errors continue as is...
F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\cocos2dorig.obj Cocos2dXWp8Framework Error 775 error LNK2001: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadHandler::~CCKeypadHandler(void)" (??1CCKeypadHandler@cocos2d@@UAE@XZ) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCImage_win8_metro.obj Cocos2dXWp8Framework
...
Error 1482 error LNK2001: unresolved external symbol "public: virtual void __thiscall cocos2d::CCTMXMapInfo::textHandler(void *,char const *,int)" (?textHandler@CCTMXMapInfo@cocos2d@UAEXPAXPBDH@Z) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCDrawingPrimitives.obj Cocos2dXWp8Framework Error 1483 error LNK2001: unresolved external symbol "public: virtual void __thiscall cocos2d::CCTMXMapInfo::textHandler(void *,char const *,int)" (?textHandler@CCTMXMapInfo@cocos2d@UAEXPAXPBDH@Z) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\cocos2d.obj Cocos2dXWp8Framework Error 1484 error LNK2019: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadDispatcher::~CCKeypadDispatcher(void)" (??1CCKeypadDispatcher@cocos2d@UAE@XZ) referenced in function "public: virtual void * __thiscall cocos2d::CCKeypadDispatcher::`vector deleting destructor'(unsigned int)" (??_ECCKeypadDispatcher@cocos2d@UAEPAXI@Z) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCDirector.obj Cocos2dXWp8Framework Error 1485 error LNK2001: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadDispatcher::~CCKeypadDispatcher(void)" (??1CCKeypadDispatcher@cocos2d@UAE@XZ) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCLayer.obj Cocos2dXWp8Framework Error 1486 error LNK2001: unresolved external symbol "public: virtual __thiscall cocos2d::CCKeypadDispatcher::~CCKeypadDispatcher(void)" (??1CCKeypadDispatcher@cocos2d@UAE@XZ) F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\CCEGLView_win8_metro.obj Cocos2dXWp8Framework Error 1487 error LNK1120: 48 unresolved externals F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\Win32\Debug\cocos2d\Cocos2dXWp8Framework.dll Cocos2dXWp8Framework
Solution / Project paths:
F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx.sln F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\GameWp8Dx\GameWp8Dx.csproj F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\GameWp8DxComponent\GameWp8DxComponent.vcxproj F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\cocos2d.vcxproj
Cocos2d Include files:
F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\cocos2dx\include F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\cocos2dx\platform
Object files built here:
F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\HelloWorld\Win32\Debug*.obj
.dll / .lib built here:
F:\src\WindowsPhone\GameWp8Dx\GameWp8Dx\Cocos2dxWp8\Win32\Debug\cocos2d
Sorry for the long post, but I hope that's enough details to get this question going. Thanks.