wxWidgets font error in Code::Blocks "assert "numWeight > 0" failed in GetWeightClosestToNumericValue()"

Viewed 4718

I've been recently suffering from a error dialog keep popping up whenever I use Code::Blocks.

It says "A debugging error in this application has failed." and "....\include/wx/font.h(282): assert "numWeight > 0" failed in GetWeightClosestToNumericValue()."

This thing has been popping up since I tried to change my fonts in Code::Blocks, and since then whenever I change my font to something else, it always get reset.

The dialog pops up when I start up the Code::Blocks, when I open a source code in Code::Blocks, and when I open Settings-Editor in Code::Blocks.

I've looked up for similar cases around, and they said it's a problem with wxWidgets, but still I couldn't find any solution that can fix this problem.

I also tried enabling "Reset zoom of all editors to defaults, if leaving dialog", and it didn't work either.

(Also tried removing and reinstalling Code::Blocks, and the issue still exists)

If anyone could help me resolving this problem, I would be truly grateful.

enter image description here

4 Answers

As the user tguichaoua hints to, erasing your config file will help.

It is located in %APPDATA%\CodeBlocks\default.conf (this might vary if you're using the portable version).

For me opening it and finding the FONT tag (<FONT>...</FONT>) and deleting it was enough to reset the editor font and fix the constant errors.

Also apparently this is fixed in the newer versions of CodeBlocks (since at least June 2020) so you might want to change to a nightly version instead. I have had no such issues with fonts using the latest nightly.

if you customize the theme of CodeBlocks, it may occur that problem! so..let's solve it... you can have a try with simple methode:

select "Setting"->"Editor",then click "General Setting" section,choose "Font" and choose "Size":12 or 18,Don't choose 14 or 16...

..Amazing, it works...

Well, I'm not sure if this is an ultimate solution, but it seems like the older versions of Code::Blocks do not have such issues.

I uninstalled the current version (20.03) and installed previous version (17.12) and it's working just fine!

I solve the problem by deleting all files in ...\AppData\Roaming\CodeBlocks and restart Code::Block.

Related