← Blog

GDK Pixbuf error when running a wxWidgets app on Linux

Fix the GDK Pixbuf 'Could not load a pixbuf from icon theme' error when running wxWidgets apps on Linux. Quick diagnosis and solution.

If you encounter an error message saying “Could not load a pixbuf from icon theme” on Linux, note that it might be just a VSCode error.

As explained in my Menus video (the “Problems with Icons on Linux” chapter), this error may occur when using the default system icons, for example when using submenus and option items in the main menu.

wxWidgets: Main Menu and Context Menus Play video: wxWidgets: Main Menu and Context Menus

Running a simple menu application from VsCode results in weird icons and the mentioned error message.

wxWidgets menu showing broken GDK pixbuf icons on Linux in VS Code

Messed up menu icons

The simple solution is to run the program from the command line, not VsCode. The error disappears, and the icons look correct.

wxWidgets menu with correct icons when launched from terminal on Linux

Icons when running the app outside VsCode

The issue with VsCode is that the editor sets some GDK environment variables that prompt the GTK library to search for the default icons in the wrong directory.

Conclusion

Unfortunately, this bug is not yet fixed. If you’d like to speed up the process, consider upvoting the GitHub issue.

Or run your Linux app from the command line, as this is the only workaround at this point.

For the full menus tutorial including context menus and accelerators, see How to use Built-in Dialogs in wxWidgets.

Written by Luke. I build custom software for businesses, made for the way your team works. Fixed price, delivered in days or weeks. I've been shipping software since 2008, co-founded Codahead, a software house in Kraków, and I've published C++ tutorials on YouTube for six years.

Recent posts

All
Your First Triangle in Apple Metal: Shaders and Vertex Buffers Oct 2026Draw a triangle with Apple Metal in a Swift playground: write the vertex and fragment shaders, build the render pipeline, send vertices with setVertexBytes or an MTLBuffer, and get the memory alignment right. Your Business Deserves a Native App Oct 2026Many of your team's apps are web pages in disguise, and you pay for it in waiting. When Shopify rebuilt its shopping app as native, it started opening twice as fast on Android. Here's what native could do for your business. XFCE on 4K Displays: Correct Scaling in Five Settings Oct 2026XFCE's Window Scaling option only scales GTK apps. Here are the five settings that make a 4K display look right in GTK, Qt, Firefox and Emacs, plus fractional scaling.