Error while deploying project

Hey all, hope you all are well.
For deploying my project, I used the command
cocos deploy -s -p win32 -m release
but I got four errors.


Currently, I am using cocos2d-x-4.0, python 2.7.10, cmake 3.15.6 and VS2019
Before this, I was using visual studio to run in release mode and it worked.

Do you have any other VS installation like 2017 or 2015? in console you can specify version with:

Windows Options:
–vs VS_VERSION Specify the Visual Studio version will be used. Such
as: 2015. Default find available version
automatically.

And what is your configuration in project properties?
(General:

  • Windows SDK Version
  • Platform Toolset)

i’m not sure if 2019 is supported maybe it worked cause you have an older api or older platform toolset configured in project, can someone please confirm? i cant find the available options in console output.

(just my opinion i would not use v4 for any other platform than iOS or OSX for the moment)

I have both VS 2017 and 2019.
here is full output of console:

Building mode: release
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:Maze
-- PROJECT_SOURCE_DIR:C:/Users/itsme/Maze
-- COCOS2DX_ROOT_PATH:C:/Users/itsme/Maze/cocos2d
-- CMAKE_MODULE_PATH:C:/Users/itsme/Maze/cocos2d/cmake/Modules/
-- PROJECT_BINARY_DIR:C:/Users/itsme/Maze/win32-build
-- ENGINE_BINARY_PATH:C:/Users/itsme/Maze/win32-build/engine
-- PYTHON_PATH:C:/Python27/python.exe
-- COCOS_COMMAND_PATH:C:/Development/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:C:/Development/cocos2d-x-4.0/tools/cocos2d-console/bin/../plugins/plugin_luacompile/bin
-- LUAJIT32_COMMAND:C:/Development/cocos2d-x-4.0/tools/cocos2d-console/plugins/plugin_luacompile/bin/32bit/luajit-win32.exe
-- LUAJIT64_COMMAND:C:/Development/cocos2d-x-4.0/tools/cocos2d-console/plugins/plugin_luacompile/bin/64bit/luajit-win32.exe
-- cocos_mark_code_files: cocos2d
-- cocos_mark_code_files: Maze
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/itsme/Maze/win32-build
running: 'cmake --build . --config Release'

Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Copying resources for Maze ...
      copying to C:/Users/itsme/Maze/win32-build/bin/Maze/Release/Resources
  ext_clipper.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_clipper.lib
  ext_convertUTF.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_convertUTF.lib
  ext_edtaa3func.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_edtaa3func.lib
  ext_md5.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_md5.lib
  ext_poly2tri.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_poly2tri.lib
  ext_recast.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_recast.lib
  ext_tinyxml2.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_tinyxml2.lib
  ext_unzip.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_unzip.lib
  ext_xxhash.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_xxhash.lib
  ext_xxtea.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\ext_xxtea.lib
  external.vcxproj -> C:\Users\itsme\Maze\win32-build\lib\Release\external.lib
  UIEditBoxImpl-win32.cpp
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(64,70): error C2065: 'GWL_WNDPROC': undeclared i
dentifier [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(101,42): error C2065: 'GWL_WNDPROC': undeclared
identifier [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(124,40): warning C4312: 'type cast': conversion
from 'int' to 'HMENU' of greater size [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(128,42): error C2065: 'GWL_USERDATA': undeclared
 identifier [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(129,66): error C2065: 'GWL_WNDPROC': undeclared
identifier [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(246,34): warning C4267: 'initializing': conversi
on from 'size_t' to 'int', possible loss of data [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(280,22): warning C4244: 'argument': conversion f
rom 'const float' to 'int', possible loss of data [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(279,22): warning C4244: 'argument': conversion f
rom 'const float' to 'int', possible loss of data [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(278,24): warning C4244: 'argument': conversion f
rom 'const float' to 'int', possible loss of data [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
C:\Users\itsme\Maze\cocos2d\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(277,24): warning C4244: 'argument': conversion f
rom 'const float' to 'int', possible loss of data [C:\Users\itsme\Maze\win32-build\engine\cocos\core\cocos2d.vcxproj]
Error running command, return code: 1.

I was previously using v3, but I encountered some issues (sorry, I forgot those issues) that were resolved by switching to v4

First message in output
try use --vs 2017 or 2019

Thanks for your suggestion.
Can someone please suggest to how to set VS version while deploying?

Can anyone help me please? :slightly_frowning_face:

TBH, I don’t know a lot about this command on Windows. I think these days it is acceptable to run cmake and generate a Visual Studio project and then use Visual Studio to build/deploy your project.

Thanks, it’s okay.
I did the same thing. Generated first by CMake, then build and deploy by Visual Studio and it worked, but I tried command line to deploy as I was wondering if I could release my project for other platforms as well.

You could build from the VS command-line tools if you still need to automate the build process.

I tried. When I am using VS command-line then it should work but still it is showing the same message “Can not find VS version or not specified”

VS can’t find VS?

Did you try running vcvarsall.bat

Read this: https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019#how-to-use-the-command-line-tools

I think the problem is with VS 2019.

Worked for me with VS 2017

steps i did: (i assume you have installed cocos2d-x v4 so the path to cocos command is the console of v4)
1: cocos new -p test -l cpp test
2: cd test (change directory to the root of project)
3: cd proj.win32
4: cmake . . -G"Visual Studio 15 2017" -Tv141
5: cd . . (back to root project)
6: cocos compile -m release -p win32 --vs 2017
7: cocos deploy -p win32 -m release

first of all there is no --vs option on deploy it is on compile. My bad.
second: compile and deploy i think are the same thing for win32

both commands generated a folder called win32-build:
image

with the same content.

try it this way if you want, then tell me your results.

hope it helped. :grinning:

Thanks for help.

I was using VsDevCmd.bat
After you suggest this I tried running vcvarsall.bat but it gave just a flash of its window then closed.

So sorry, I forgot I had a format recetly, after that i did not installed VS2017.
IDK what is happening but now i can’t even able to generate a new cmake with VS2019 it shows can not find any instance of Visual Studio. Maybe this is because of I have a update for VS but i can’t update because of lack of internet.

sorry I don;t have VS2017 my bad. And it isn’t working for VS2019 :neutral_face:

Hi @rahul_d_v ,

  1. are you able to build the project from Visual Studio IDE?
  2. what was the cmake command you used to generate the project?
    you can try this for 2019
    cmake … -G"Visual Studio 16 2019" -Tv141

Hi @Darren
Everything is working in VS IDE but isn’t working in command line. I have released version of my project by VS but only for windows and I want that for other platform as well. That’s why I used command line.
cmake command I used was…
cmake … -G"Visual Studio 16 2019" -A Win32

What do you mean exactly by “I want that for other platform as well”? What other platform?

I mean by other platform is other operating system. I mean, I made this for windows so i was wondering if i could release it for linux and mac also.

Have you seen this info about using CMake for different platforms? https://github.com/cocos2d/cocos2d-x/tree/v3/cmake

Okay, got it. Is this means that I have to generate separate cmake for Mac and which can only be done with Xcode which is not available for Windows?