Embedding data inside C++ code

Sometimes you have a need to add binary data to executable in a way that the binary data (image, icon, sound file) is not available as additional file in executable's folder but included inside executable. You can prepare such executable using several different approaches:

Portable solutions

  • XPM - X PixMap - XPM is a text file format for images, can be stored as a C header file
  • can be used in wxWidgets application for application icon, example
  • Embedding PNG Images
  • shows how to use hxtools bin2c with wxWidgets

Windows

Linux/Gcc

Share

follow