Search code examples
compiler-errorsc++builderembedded-resourcec++builder-xe2

C++ Builder XE2: Resource compile "Allocate failed"


I have a resource script in my C++ Builder project. It has been the same for the last 6 years and never complained in compile.

Today suddenly I get "resource.rc(4):Allocate failed" everytime I try to compile. I have tried to reastart and do a clean. Still the same error. This is my resource script:

//-------------------------------------------------------------------
// DOCUMENT ICONS
//
IDI_DOCUMENT0   ICON      "Documents\\Pictures\\IDI_APPLICATION.ico"
IDI_DOCUMENT1   ICON      "Documents\\Pictures\\IDI_DOCUMENT2.ico"
IDI_DOCUMENT2   ICON      "Documents\\Pictures\\IDI_DOCUMENT3.ico"

//-------------------------------------------------------------------
// CUSTOM CURSORS
//
IDC_DELETE   CURSOR     "Documents\\Pictures\\IDC_DELETE.cur"
IDC_ADD      CURSOR     "Documents\\Pictures\\IDC_ADD.cur"
IDC_MOVE     CURSOR     "Documents\\Pictures\\IDC_MOVE.cur"

It fails on the first item IDI_APPLICATION.ico and if I remove it it compiles. This is strange because it has not been changed in 6 years and now suddenly it will not compile. This particular icon file's size is 201KB the other two are 158KB each and the 3 cursors are 8KB each. When you add all upp it looks like it passes the magical boundary 512KB, but hey, a resource section can be much larger than that?


Solution

  • I found out what the problem was. It seems like C++ Builder XE2 doesn't support compressed 256x256 icons (have not found this confirmed anywhere). When I regenerated the icons without compression, it compiles again.

    I have no idea why this suddenly happen, but I'm not surprised. Ever since Embarcadero took over C++ Builder the quality has been on a steady down slope...