Ok, recall I mentioned how this was so familiar a few posts back, and now I’ve realised why. It has to do with optimizations being turned on for the cocos2d library (not the game project, just cocos2d project), specifically when set to
/Ox. If you turn off optimization (/Od), or set it to Custom, then it works fine, and it’s exactly what I did to this test project when I was testing 3.17.2 after it was released, and the reason that my project compiled fine earlier.
I’m sorry that I completely forgot I had made those changes to it, and only discovered it when I created a new test project now to try and reproduce the issue you’re seeing.
If you set optimizations to Custom, then you can turn on a few items and it will still compile fine, like what you see here:
This issue has happened a few times with previous versions of Visual Studio, and it’s not specific to Cocos2d-x.
@larsven An alternative solution is to add the following lines to CCController-linux-win32.cpp (which seems to be the actual cause of this issue, and not LocalStorage.cpp):
#pragma optimize( "", off ) // Add this before the class declaration
class CC_DLL ControllerImpl
#pragma optimize( "", on ) // Add this at the end of class declaration (approx. line 4908)
Then you can leave the optimization set to /O2 and it will compile fine, just skipping the code that is included in those files. I’m curious if this fixes the issue for you too.