← 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
SwiftUI & Metal: Rotating a Triangle with a Slider Oct 2026Connect a SwiftUI slider to an Apple Metal renderer: pass the value with @State and @Binding, turn it into a float4x4 rotation matrix, and send it to the vertex shader with setVertexBytes. Apple Metal on Your Phone: Bridging SwiftUI and MTKView Oct 2026Move Apple Metal code from a Swift playground to a real SwiftUI app for iPhone and Mac: wrap MTKView with UIViewRepresentable and NSViewRepresentable, and render every frame from an MTKViewDelegate. Vertex Descriptors in Apple Metal: Attributes, Offsets and Indexed Drawing Oct 2026Use MTLVertexDescriptor so your Swift and Metal vertex structs don't have to match, calculate attribute offsets the right way with MemoryLayout.offset(of:), and draw a square from four vertices with an index buffer.