If you use it as you have tried, cmake will make a 64bit solution and cocos is not compatible with it out of the box so you have to specify the 32bit command.
I tried with cocos run -p win32, and get the same error.
Please advise.
Microsoft Windows [Version 10.0.18363.476]
(c) 2019 Microsoft Corporation. All rights reserved.
D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests>cocos run -p win32
Xiamen Yaji Software Ltd. collects anonymous data when the command-line tools are used for development. This data is examined in the aggregate only and is used to continually innovate and improve Cocos products. This data is anonymous and includes, but is not limited to, a unique hardware identifier, version number our software and information on which tools and/or services in Cocos products are being used and how they are being used. We take your privacy seriously and we do not share or sell any of this data. You can opt-out from sharing this data with us, but by sharing you help contribute to growth of Cocos.
Our entire policy can be viewed at: http://www.cocos2d-x.org/licenses.
For questions please e-mail privacy@cocos2d-x.org.
Do you agree to sent the data? [Y]es, [N]o
y
Building mode: debug
Can not find VS version or not specified
running: 'cmake ..'
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- PROJECT_NAME:cpp-tests
-- PROJECT_SOURCE_DIR:D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests
-- COCOS2DX_ROOT_PATH:D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/../..
-- CMAKE_MODULE_PATH:D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/../../cmake/Modules/
-- PROJECT_BINARY_DIR:D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/win32-build
-- ENGINE_BINARY_PATH:D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/win32-build/engine
-- PYTHON_PATH:D:/Python27/python.exe
-- COCOS_COMMAND_PATH:D:/Cocos2d-x/cocos2d-x-4.0/tools/cocos2d-console/bin/cocos
-- HOST_SYSTEM:Windows
-- CMAKE_GENERATOR: Visual Studio 16 2019
-- using Windows MSVC generate cocos2d-x project, MSVC_VERSION:1924
-- COCOS2DX_LUAJIT_ROOT:D:/Cocos2d-x/cocos2d-x-4.0/tools/cocos2d-console/bin/../plugins/plugin_luacompile/bin
-- LUAJIT32_COMMAND:D:/Cocos2d-x/cocos2d-x-4.0/tools/cocos2d-console/plugins/plugin_luacompile/bin/32bit/luajit-win32.exe
-- LUAJIT64_COMMAND:D:/Cocos2d-x/cocos2d-x-4.0/tools/cocos2d-console/plugins/plugin_luacompile/bin/64bit/luajit-win32.exe
-- cocos_mark_code_files: cocos2d
-- cocos_mark_code_files: cpp-tests
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/win32-build
running: 'cmake --build . --config Debug'
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Copying resources for cpp-tests ...
Building Custom Rule D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/CMakeLists.txt
copying to D:/Cocos2d-x/cocos2d-x-4.0/tests/cpp-tests/win32-build/bin/cpp-tests/Debug/Resources
ext_clipper.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_clipper.lib
ext_convertUTF.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_convertUTF.lib
ext_edtaa3func.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_edtaa3func.lib
ext_md5.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_md5.lib
ext_poly2tri.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_poly2tri.lib
ext_recast.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_recast.lib
ext_tinyxml2.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_tinyxml2.lib
ext_unzip.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_unzip.lib
ext_xxhash.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_xxhash.lib
ext_xxtea.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\ext_xxtea.lib
external.vcxproj -> D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\lib\Debug\external.lib
UIEditBoxImpl-win32.cpp
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(64,70): error C2065: 'GWL_WNDPROC': undeclared id
entifier [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\core\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(101,42): error C2065: 'GWL_WNDPROC': undeclared i
dentifier [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\core\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(124,40): warning C4312: 'type cast': conversion f
rom 'int' to 'HMENU' of greater size [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\core\cocos2d.
vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(128,42): error C2065: 'GWL_USERDATA': undeclared
identifier [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\core\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(129,66): error C2065: 'GWL_WNDPROC': undeclared i
dentifier [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\core\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(246,34): warning C4267: 'initializing': conversio
n from 'size_t' to 'int', possible loss of data [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\co
re\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(280,22): warning C4244: 'argument': conversion fr
om 'const float' to 'int', possible loss of data [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\c
ore\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(279,22): warning C4244: 'argument': conversion fr
om 'const float' to 'int', possible loss of data [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\c
ore\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(278,24): warning C4244: 'argument': conversion fr
om 'const float' to 'int', possible loss of data [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\c
ore\cocos2d.vcxproj]
D:\Cocos2d-x\cocos2d-x-4.0\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(277,24): warning C4244: 'argument': conversion fr
om 'const float' to 'int', possible loss of data [D:\Cocos2d-x\cocos2d-x-4.0\tests\cpp-tests\win32-build\engine\cocos\c
ore\cocos2d.vcxproj]
Error running command, return code: 1.