I used Vs2019, but cocos2d-x doesn’t support for it when build *.exe, So I removed it first.
I install Vs2017 [build tool 141] and run in VS oke,
I go CMD to build DEBUG mode :
cocos compile -p win32 // everything oke
But with:
cocos deploy -p win32 -m release
I got :
“1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: The build tools for v142 (Platform Toolset = ‘v142’) cannot be found. To build using the v142 build tools, please install v142 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting “Retarget solution”.”
It’s weird error, because BuildTool v142 cannot be installed on Vs2017. It’s oke on Vs2019 (2019 cannot build file *.exe)
Are you using the Visual Studio solution file that is located in the [YourProjectRoot]\proj.win32\? If so, don’t, since that project is not the correct one to use. Don’t modify that folder in any way.
You didn’t mention CMake, so if you’re not using it, then you need to in order to generate the correct Visual Studio 2019 project (you could even use VS2022 etc).
Try this from the root folder of your Cocos2d-x project:
mkdir build-win32
cd build-win32
cmake .. -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release
That will generate the VS2019 solution files in the build-win32 folder. Open the generated build-win32/[projectname].sln file that you see in there, and that should work.
If you want to use VS2017, then it will be this command to create the project files: cmake .. -G"Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release
Hi R101:
your ‘cmake … -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release’,
Make me error when clicking Build In VS:
lack of ’ lib\Release\cocos2d.lib ’
But: cmake … -G"Visual Studio 16 2019" -A Win32 -Tv142 // enough lib to build
I built a release mode for game with file *.exe has game_icon
Thank you!