After Creating a new cocos2d application unable to open the project in Visual Studio 2019

After Creating a new cocos2d application unable to open the project in Visual Studio 2019
0

Hi ,

I have created a new cocos2d project using cocos2d console .

I have specified the language as cpp and there is a , proj.win32 folder generated but I can’t find any solution for the project as such. So if this support has been recently removed is there any way I can open the project with all the cocos2d dependencies in Visual Studio 2019 ?

what version of cocos2d-x are you using?

I am using the latest version 4 cloned from github.
(https://github.com/cocos2d/cocos2d-x)

Ignore that folder. While it’s still required, that isn’t actually the project folder. You need to generate it via CMake:

mkdir win32build
cd .\win32build
cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32

The win32build folder will contain the [gamename].sln solution file that you open up in VS2019.

If you want to save yourself some time, add the following to a batch file (like VSUpdateCMake.bat), then simply copy it to the root folder of any project you make and run it to create the solution/project for VS2019:

IF EXIST .\win32build\ GOTO RUNCMAKE
mkdir win32build
:RUNCMAKE
cd .\win32build
cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32

You will also need to run the same CMake command any time you add resources or new files to CMakeLists.txt.

1 Like