This tool was created to embed binary resources into c++ header/source files. It can process multiple files and even directories which makes it useful for IDE integration (pre-build steps).

Hint: The output files are ~5x larger then the binary resources, so only add small binary files!



  1. don't use any parameters to start GUI mode
  2. append any file(s) you want to embed: bin2hpp.exe "file1" "file2" "file3" ...
  3. append any directory(s) you want to embed: bin2hpp.exe "dir1" "dir2" "dir3" ...
  4. *directories are scanned recursively
  5. the default output directory is the bin2hpp folder
  6. use the "out=" parameter to specify the target directory: bin2hpp.exe "out=c:\dir_out" "file1" "dir1" ...

Drag & Drop

  1. select one or more files/directories
  2. drag and drop them onto bin2hpp.exe
  3. wait until bin2hpp is finished
  4. the resources.h and resources.cpp files are located in bin2hpp's directory

Graphical Interface

  1. start bin2hpp.exe without any parameters
  2. add some files to the list by using the corresponding button
  3. to delete files from the list, tick the checkboxes of the files and click the remove button
  4. click the create button to start embedding all files from the list
  5. select a directory where you want to safe the h/.cpp file
  6. wait until the console window has finished
  7. the resources.h and resources.cpp files are located in the selected output directory

The Output Files

The header file (resources.h) holds the declaration. All added files are members of the RESOURCES structure. The member names are converted to fit the C++ conventions. Invalid characters are replaced by undersores. Member names with a leading number are prefixed by an underscore. All letters are transformed to uppercase for visual purposes. The members are of type RCDATA, which has a data property (unsigned char*) and a length property (unsigned int). The source file (resources.cpp) implements the data of all members. This file might be large, so treat it carefully. To use the resources you need to include resorces.h and add resources.cpp to your project.


Lets assume you added logo.png with bin2hpp into resources.h, then you should find a member with a name similar to LOGO_PNG inside the RESOURCES structure. This is how you can access the members:

unsigned char* logo =;
unsigned int logo_size = RESOURCES::LOGO_PNG.length;

Example resources.h file:

Example resources.cpp file: