Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed data in an application

I want to make an application, but the application will be using icons (bitmaps) for some of the menu buttons and other stuff. I want to keep my application as one simple, single standalone exe file which means I will somehow have to embed all of the icons into the application (EXE on windows) so I can load the bitmaps without having any external files.

Does anyone know how I can do this?

Just some other info: I'm using wxWidgets, currently with MSVC and I would prefer a method that works cross compiler/cross platform if possible.

Thanks in advance!

like image 734
Brad Avatar asked Dec 13 '25 07:12

Brad


1 Answers

You could used the XPM format for your bitmaps, as it's easy to embed in your code (which of course is going to be in the exe, right where you want it;-). As the docs say,

All wxWidgets platforms support XPMs for small bitmaps and icons. You may include the XPM inline as below, since it's C code, or you can load it at run-time

(the "as below" being a #include directive) -- so, you would be perfectly cross-compiler and cross-platform by adopting this approach with the "include" option.

For more info about the XPM format, see here. It's easy to find converters to XPM from other popular formats, of course.

like image 88
Alex Martelli Avatar answered Dec 14 '25 20:12

Alex Martelli