Problems with png resources in win32 project

The filepath is ok. As i’ve mentioned before, the cpp tests have the same problem. It is something with the OS, what’s left to know is what exactly :frowning: Each day i am closer to reinstalling Windows

I think if you have a O/S-level issue loading images you’d soon know about it. If it’s affecting your Cocos2d-x work only, and it’s affecting both cpp-tests and your own game then it’s likely a corruption in the cocos2d-x source tree/library. I would first look at saving your game project somewhere (i.e. github) and reinstalling Cocos2d-x.

I mentioned that i reinstalled it completely. Still same problem

Can you try this please:

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:

  1. Open a command window (CMD.exe).

  2. Type:
    cd c:\cocos\cocos2d-x\tests\cpp-tests [press Enter]

  3. 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.

Report back and let us know if it works or not.

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:
image

The engine folder should only have this inside it:
image

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.

The guide is here: https://github.com/cocos2d/cocos2d-x/tree/v3/cmake

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.

Yes, very, very, very, very, very, very specific. No joke.

Did I mention VERY?

1 Like

I’ve downloaded the archive from the official site, downloaded python 2.7 from the official site and then followed the installation guide here: https://docs.cocos2d-x.org/cocos2d-x/v3/en/installation/Windows.html

Oh, maybe this happened because i used a newer version of CMake?

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

Yeah, I read, but this doesn’t make any sense to me with what is happening to you.

Oh believe me it doesn’t make sense to me either :smiley:

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!!!

Sorry, please post the original value you had and the correct value so we can see, please.

Yes, of course, but can u specify what exactly do u need?

What did you actually do? What was the old value? what was the new value you specified?

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