[SOLVED] Compiler Executable Issue No. 1

[SOLVED] Compiler Executable Issue No. 1
0.0 0


Greetings everybody!

Coming from Cocos2D, started now with Cocos2D-X.
Thanks to your outstanding effort, it is finally possible to utilize Cocos2D Framework cross-plattform.

Currently i am using VS2013 as my IDE with Cocos2D-X v.2.2.2.
All compiles fine inside the IDE, 0 errors, 0 warnings. (Debug)

BUT, the problem/issue pops up on execution.
The compiled EXE file doesn’t start at all! (C:\cocos2d-x\Debug.win32)


It just says “HelloCpp.exe doesn’t work anymore”.
No idea why this happens, need your help here.

Thank you for replies.

Kind regards,

It seems others have encountered this as well:

I will try this out now and confirm if it works.

display1.jpg (139.4 KB)


Alright, copying everything from Resources to the Debug.win32(Release.win32)folder works.
Confirmed. For testing purposes it is great!
However, a distribution of an executable with all the resources dropped into the root folder is pretty ugly. :wink:

Which brings me to the next question:
Is there a way of including whatever is inside the resource folder in the executable itself?
So can we have a nice, one EXE file with all resources inside?

That would be really outstanding.

Maybe you could consider this in your next release guys.
Stuff like that really shouldn’t happen.


No, you cannot do that – executables are for executable code :wink:

Every game you’ve ever used has an executable

You can write a tiny patch in CCFileUtil to read the files from an encrypted .PAK file, or read them from a folder called ‘data’ or encrypt each file, mask the filenames, whatever.


Hey corytrese,

thank you for pointing out CCFileUtil and .PAK files(as example).

Saying “No, you can’t” however is not absolutley true.
This is especially not true in the case of Visual Studio:

Yes, every game i’ve used had an executable, but you know,
some of them contain all the resources. :smiley:

While other exes, have external data in a separate resource folder.
But Cocos2D-X architecture is of course different and is not using Win32 API.
Besides, i think you’re right, a modular approach is more productive while testing and developing.

Anyhow, let’s create a data folder with all resources inside as you suggested.
The exe is throwing the error again: “HelloCpp.exe doesn’t work anymore”.

Note: What i am trying to achieve here is that at the end of the day, similar to Mac OS with XCode where
you’ll get an .IPA file to distribute, only on mighty Windows with an .EXE file.

I alredy have a working wrapper for iOS(XCode 4.5), now working on the Windows version(VS2013) one and if all goes well, Android should be next. Also i wouldn’t mind to share it when finished, via github.

So how would i load from the data folder we just created now?
Where in CCFileUtil should the “tiny” patch be and look like?

That would be enough for a start, having a “data” folder and an exe,
looks a little bit cleaner.


After fighting with this for while now, i’ve found it is rather unnescessary to have all resources in the executable.
That way my designers can test stuff quickly by simply swapping images inside the folders.

To keep it easier to maintain, i’ve split all resources in folders now (inside resource dir).
On creating a sprite, simply select your folder. Example:
_btnInfo = CCMenuItemImage::create("mm-gfx/btn-info.png", "mm-gfx/btn-info-sel.png", this, menu_selector(MainMenuLayer::switchToInfoScene));
So as you can see, pretty easy actually. Now its portable and easy to maintain.
Don’t forget to add the dynamic libraries to your final output folder.

Later, it is also possible to add some compression(*.pak, *.wad, etc) to the resources.
The problem is solved for me, hope this post will help those who will encounter it in future.

For distribution you’ll need the MSVC Runtime.
Or actually just 2 files from MSVC. (I’ve attached these below)
Note: The “D” at the end of each file is for “DEBUG”.