Firstly, I’m going to assume you set up cocos2d-x correctly, and that you have CMake installed on your PC. If you don’t have CMake installed, get it from here: cmake.org. Download CMake 3.15.4 x64 (or x86 if you’re using 32 bit Windows), and install it.
For the sake of this, let’s just say your cocos2d installation is in C:\Cocos\cocos2d-x, so just replace that with the true path you’re using.
Now, do the following:
Open a command window (CMD.exe).
Type: cd c:\cocos\cocos2d-x\tests\cpp-tests [press Enter]
Now, type the following and press the Enter key after each line: mkdir win32build cd win32build
If you have Visual Studio 2019, then type this: cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32
Otherwise if you’re using Visual Studio 2017, then type this: cmake .. -G"Visual Studio 15 2017" -Tv141
Once you’ve done that, CMake would have created a new Visual Studio solution in the win32build folder, c:\cocos\cocos2d-x\tests\cpp-tests\win32build\cpp-tests.sln. Open this cpp-tests.sln file in Visual Studio, then build and run it.
This method worked!!! However, found the cpp-tests.sln in this directory:C:\Development\Cocos2d-x\cocos2d-x-3.17.2\win32build\engine\tests
So, how should i create new projects now? Using cmake somehow?
That is not possible, and I don’t understand how it would get into the engine subfolder, and there shouldn’t even be a tests folder in the engine folder. Something is really wrong with your setup, or how you installed and configured Cocos2d-x.
This is how it should be:
The engine folder should only have this inside it:
Anyhow, what this test shows is that it’s most likely user error, and not a fault of your Windows installation or Cocos2d-x.
Also, you should not be using the Visual Studio project files located in the [gamename]\proj.win32 folder after you create a new game using the cocos -l ... command. There have been numerous posts related to it. It’s best that you always create your Visual Studio project files using CMake, the same way you did for the cpp-tests project.
Perhaps @themronion should download the .zip from our website and use that? It should contain everything needed, except CMake and Visual Studio, which seem to be installed and working. Remove everything and check your $PATH to make sure nothing has snuck in.
Actually, that’s a good question, @themronion where exactly did you get your cocos2d-x files from? Also how did you install it? Be very specific and detailed in how you installed and set up cocos2d-x.
I test these instructions each release and I don’t end up with pieces in awkward file locations. Perhaps remove everything and start over following these instructions. You said all you did to have this failure occur was re-build instead of build… this doesn’t change file system locations.
Yeap. I created that project in july somewhere. Then i forgot about it. Then, now, in October i tried to do something again. Everything went well and then bang, i pressed rebuild. And this happened
I specified just the cocos2d-x directory for CMake the fist time, my mistake, sorry. Everything is ok. Going to mark your reply as a solution! Thank u everyone!!!
When doing the CMake project i made the win32build directory in the root directory of cocos2d-x, instead of tests/cpp-tests. However the problem with build/rebuild is still not resolved