Prebuilt for win32, "cocos gen-libs -p win32 ..."

Prebuilt for win32, "cocos gen-libs -p win32 ..."
0.0 0



Cocos team - thank you for “cosos gen-libs”.
There is good documentation how to generate prebuild library. But missing is very important part: how to use it :wink:

Below my steps how to setup prebuild “cosos gen-libs” for win32. Could you send me steps for Android on Windows? I read all 58 posts of How to speed up cocos2d-x build with prebuilt lib but still failed on Android …

My Working folder g:\gen-libs-test. Checked on:, Windows 10, VS 2015 Community

  1. download and unzip cocos2dx source to g:\gen-libs-test\cocos2d
  2. Create test project
    cocos new -l cpp test
  3. remove cocos2d folder from test project
    rmdir /S /Q test\cocos2d
  4. Build cocos gen-libs
    cocos gen-libs -p win32 --vs 2015 -m debug
  5. fix incorrect output files
    cd cocos2d\prebuilt\win32
    copy libcocos2d_2015.dll libcocos2d.dll
    copy libcocos2d_2015.lib libcocos2d.lib
    copy libbox2d_2015.lib libbox2d.lib
    copy libSpine_2015.lib libSpine.lib
    cd g:\gen-libs-test
  6. Update *.sln, *.vcproj to prebuild folder. (It can be done also from UI) Below git diff in attached (2.2 KB)
  7. Open VS solution Double click g:\gen-libs-test\test\proj.win32\test.sln
  8. Run i.e. in debugger - F5 (only AppDelegate.cpp HelloWorldScene.cpp main.cpp should be compiled)

Below “cocos gen-libs” issues:

  1. Output files generated with postfix “_2015.lib” are incorrect - I think should be without _2015
  2. Debug overwrites release (the same issue exist for other platforms)
    cocos gen-libs -p win32 --vs 2015 -m debug
    release output dir is the same as release
    cocos gen-libs -p win32 --vs 2015 -m release

I think that cpp-template-prebuild could be very useful for prebuild. And next we can just call “cocos new -l cpp -t cpp-template-prebuild test”


How to speed up cocos2d-x build with prebuilt lib

Hey @CrazyHappyGame,

Thanks for that, really helped me get it going. Did you manually made the changes to the *.sln and *.vcproj files, or did it from the UI and just posted the diff?

I think that, maybe doing another Steps for that Project configuration using UI would help many people. Cause if someone make any mistakes when manually editing those files, could be a hard thing to track it down and fix it.

Yet, it helped me very much.




Here is my sulotion to reduce size in windows :


OK, but this doesn’t make use of the prebuilt libraries.

I have just found a very quick guide - almost a shortcut - on how to quickly setup a Cocos2D-x Visual Studio project to work with the prebuilt libraries: