Failed to write injected code block to PDB

Failed to write injected code block to PDB
0.0 0


Hi, I was updating my project to use the new 3.0 version. I fixed all deprecated stuff, but I still get compile error that I don’t quite understand how to fix. Compiler gives many this kinda errors: error C3130: Internal Compiler Error: failed to write injected code block to PDB

Has anybody else had this issue or know how to fix it?

All I found from internet is that the most common reason for the failure is lack of disk space, but I have lots of free space so it doesn’t make sense and the same project have worked nicely with older cocos2d-x versions.

This error happened in windows. Both visual studio 2012 and 2013 give the same error.

cocos2dx 3.x compiler issue

I get the same when trying to compile with vs2013, but they only happen in the actual test projects. The binaries of the actual library still compile fine. Maybe the same is the case for you?


Yeah the cocos library alone compiles fine for me also. But with my project it errors with the 3.0 version.

I did managed to get it compile by setting debug information format to none, so it didn’t generate any PDB file, but that is hardly any fix cos now cannot debug. :stuck_out_tongue:

The PDB file size grows really big during compiling of my project. First it is compiling fine, but when PDB file size gets to around 300 MB then it start spamming the “Internal Compiler Error: failed to write injected code block to PDB” error. My project is having about 400 files and 40’000 lines of code. With smaller projects this doesn’t cause problem tough cos the PDB file never grows that big.

Looking inside the PDB file there seem to be lots of this kinda stuff with different actions:
//+++ Start Injected Code
::cocos2d::Action * ::cocos2d::Place::clone() const

They all say that clone method, but have different action. Maybe some template stuff. :stuck_out_tongue:

Anybody have any idea how to fix this?


My guess would be that some template is maybe causing code to be bloated by creating copy of some long template code for all the permutations of CCAction cloning.


Still not working in RC1.

I noticed there was bug report about this happening in release mode that was marked resolved.

But the fix seemed to be just to use /Z7 instead of /Zi.

The issue happens in debug mode also tough and not just release. And just always using /Z7 and not being able to use newer /Zi or Edit and Continue is not very nice “fix”.


I dont know too much about this PDB file but it seems to me bit strange that it’s full of this start inject clone code for actions. Like this is spammed many times in that PDB file:

//+++ Start Injected Code
::cocos2d::ActionInterval * ::cocos2d::EaseCircleActionIn::clone() const 
    return ::cocos2d::EaseCircleActionIn::clone();

Not expert with this PDB stuff but seems like something is bloating it.

And yeah it happens also with the cocos test project and have tested it with two computer and both has this error.


Did bit more testing. Changing to not inherit Action from Clonable made the PDB size a lot more smaller. From over 330 MB (possibly would have grow even more but that error stopped it), to now only 46 MB and no “failed to write injected code block to PDB” error.

So yeah could somebody check this cloning implementation and see what is wrong with it?


Hi, I am having the same problem. Any ideas on how to fix this issue properly?


I have same problem , what can i do?


This problem happened to me because I set one or more of the libs to have a PDB, where no lib should have a PDB except executable projects.


Still no solution?


I am getting the same error using VS2013. I tried making Action not derive from Cloneable and I still get the error. Anyone else figure this out?


I had this problem before and fixed it, then upgraded to 3.3 final (along with many updates to the game itself) and have the issue again on the first attempt to build solution. Tried changing debug to just database (no edit continue). Still get the error. Thought maybe it was limited disk space, but freed up 15GB and still error.

I removed debugging from all 4 projects (box2d, cocos2d, spine, mygame) and it builds fine.


properties-> c/c++ -> Debug Information Format C7 compatible(/Z7)


its work for me! thks!