XRC error: Class "wxBitmap" not found

Post here wxCrafter related issues / features / bugs
iwbnwif
CodeLite Veteran
Posts: 81
Joined: Thu Mar 21, 2013 1:12 pm
Genuine User: Yes
IDE Question: c++
Contact:

XRC error: Class "wxBitmap" not found

Post by iwbnwif »

Hi,

CodeLite 9.2.8, Windows 10, wxCrafter 2.7 (licensed), wxWidgets latest from GitHub.

I have a project that has been working fine for ages until I made a small change to the text under a wxRibbonButtonBar button (and recompiled).

Now I receive run time asserts on all the icons in that particular wxRibbonButtonBar.

The following error is given:

Code: Select all

Error: XRC error: XRC resource "project-edit" (class "wxBitmap") not found
The assert occurs at line 300 of buttonbar.cpp:

Code: Select all

wxASSERT(bitmap.IsOk() || bitmap_small.IsOk());
The relevant line in the wxCrafter generated file is:

Code: Select all

m_ProjectButtonBar->AddButton(wxID_ANY, _("Edit Item"), wxXmlResource::Get()->LoadBitmap(wxT("project-edit")), _("Help String"), wxRIBBON_BUTTON_NORMAL);
Note: It is AddButton (calling InsertButton) that causes the assert, not the LoadBitmap call. Although the LoadBitmap may have failed.

And yet when I view the ribbon in wxCrafter everything appears to be normal. I have never used the XRC system manually and don't understand the mechanism so this has got me stumped.

I realise that the above is probably not enough information, so please could you let me know which files to look in to diagnose further.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: XRC error: Class "wxBitmap" not found

Post by eranif »

Can you please provide the offending wxcp file?
Make sure you have read the HOW TO POST thread
iwbnwif
CodeLite Veteran
Posts: 81
Joined: Thu Mar 21, 2013 1:12 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: XRC error: Class "wxBitmap" not found

Post by iwbnwif »

Thank you for the super fast response.

I have done some digging in the wxcp file and it seems that the problem only occurs when 2 buttons have the ID as wxID_ANY. If I give each button a unique ID, then the problem goes away.

Is that normal behaviour? I will create a test wxcp if not and upload it.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: XRC error: Class "wxBitmap" not found

Post by eranif »

iwbnwif wrote:Is that normal behaviour? I will create a test wxcp if not and upload it.
No. This is not normal behaviour
Make sure you have read the HOW TO POST thread
iwbnwif
CodeLite Veteran
Posts: 81
Joined: Thu Mar 21, 2013 1:12 pm
Genuine User: Yes
IDE Question: c++
Contact:

[Solved] Re: XRC error: Class "wxBitmap" not found

Post by iwbnwif »

Hmm, so I changed the ID back to wxID_ANY and ... no assert.

Very strange, but I guess the wxcp file was corrupted in some way, or just out of sync with the .cpp file (I am using SVN).

Thank you for your help and pointer to the wxcp file.

Just in case anyone else sees the problem in future - I temporarily changed the ID of the tool that was asserting, recompiled the wxCrafter files and rebuilt the project.
Post Reply