First Project Build Issues Windows

Hi,

I just started using cocos2d-x. And I’m having trouble to build my first project.

When I try to build in Windows with x64 target , VS 2022 I get:
Build started…
1>------ Build started: Project: SYNC_RESOURCE-MyGame, Configuration: Debug x64 ------
2>------ Build started: Project: cocos2d, Configuration: Debug x64 ------
1>Copying resources for MyGame …
1> copying to C:/game/MyCompany/MyGame/win32-build/bin/MyGame/Debug/Resources
2>UIEditBoxImpl-win32.cpp
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(64,70): error C2065: ‘GWL_WNDPROC’: undeclared identifier
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(101,42): error C2065: ‘GWL_WNDPROC’: undeclared identifier
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(124,40): warning C4312: ‘type cast’: conversion from ‘int’ to ‘HMENU’ of greater size
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(128,42): error C2065: ‘GWL_USERDATA’: undeclared identifier
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(129,66): error C2065: ‘GWL_WNDPROC’: undeclared identifier
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(246,34): warning C4267: ‘initializing’: conversion from ‘size_t’ to ‘int’, possible loss of data
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(280,22): warning C4244: ‘argument’: conversion from ‘const float’ to ‘int’, possible loss of data
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(279,22): warning C4244: ‘argument’: conversion from ‘const float’ to ‘int’, possible loss of data
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(278,24): warning C4244: ‘argument’: conversion from ‘const float’ to ‘int’, possible loss of data
2>C:\game\MyCompany\MyGame\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(277,24): warning C4244: ‘argument’: conversion from ‘const float’ to ‘int’, possible loss of data
2>Done building project “cocos2d.vcxproj” – FAILED.
3>------ Build started: Project: MyGame, Configuration: Debug x64 ------
3>LINK : fatal error LNK1104: cannot open file ‘lib\Debug\cocos2d.lib’
3>Done building project “MyGame.vcxproj” – FAILED.
========== Build: 1 succeeded, 2 failed, 13 up-to-date, 0 skipped ==========

if I set Win32 I get:

Build started…
1>------ Build started: Project: cocos2d, Configuration: Debug Win32 ------
1>Debug\cocos2d.obj : fatal error LNK1112: module machine type ‘x86’ conflicts with target machine type ‘x64’
1>Done building project “cocos2d.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 0 skipped ==========

Thanks!

Cocos2d-x doesn’t support x64 builds, but if you do need that, then try the fork of Cocos2d-x v4 that is in this repo, which does support it.

1 Like