Hacker GitHub

← All repos

nothings/stb

View on GitHub ↗ ★ 34,927 C

stb single-file public domain libraries for C/C++

111 mentions on Hacker News by 78 people: 22 stories, 89 comments · first 2014-09-21 · latest 2026-08-10

Mentions per year 111 mentions · busiest year 2016 (15)
20082026
  1. nothings' guide on how to write single-file libraries is informative if you want to write your own: https://github.com/nothings/stb/blob/master/docs/stb_howto.t...
  2. I'd use something like Sean Barrett's stretchy buffer [1] instead. [1] https://github.com/nothings/stb/blob/master/stretchy_buffer....
    comment by adrift · 2020-10-25 · in What's Wrong with C++ Templates? (2003)
  3. For me the best "package manager" are single header libraries like https://github.com/nothings/stb
    comment by atesti · 2020-08-18 · in Best Package Manager for C
  4. ▲ 3
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2020-05-20 · 0 comments
  5. ▲ 2
    Stb single-file public domain libraries for C/C++
    story by typon · 2020-05-09 · 0 comments
  6. …must be in there somewhere and would be easy to extract (or by adding another API function). https://github.com/nothings/stb/blob/master/stb_truetype.h PS: looks like it's here: https://github.com/nothings/stb/blob/f54acd4e13430c5122cab4c..…
  7. …these linter errors that accumulated in compilers over the years, based on a quick glance at STB. https://github.com/nothings/stb/issues?q=warning (29 + 132.) / (156 + 794) It's a big obstacle to sharing C code with others. It'd be great…
  8. A better resource is this: https://github.com/nothings/stb/blob/master/docs/stb_howto.t... There's an important difference between C++ style header-only libs, where the implementation is often done in inline code (especially for…
  9. Out of my personal go-to c++ libs, the only ones I missed are the stb libraries ( https://github.com/nothings/stb/ , in particular the image ones are very popular) and maybe ImGui, but that might be too niche. Also I would love to have a…
    comment by s9w · 2020-01-30 · in Awesome Modern C++
  10. https://github.com/nothings/stb/blob/master/stretchy_buffer.... Although I get you want an official standard library version, or a built in language feature.
    comment by Impossible · 2019-12-26 · in I love coding in C
  11. …It's actually a pretty clever trick, and it effectively behaves as a .h / .c pair of files. See https://github.com/nothings/stb/blob/master/docs/stb_howto.t...
  12. ▲ 4
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2019-11-15 · 0 comments
  13. …file headers for graphics tasks, like loading images, resizing images, rendering font glyphs, etc: https://github.com/nothings/stb
    comment by planteen · 2019-10-28 · in SQLite is easy to compile
  14. …https://ourmachinery.com/post/physical-design/ Simple libs widely used in game dev circles: https://github.com/nothings/stb This one is a full game engine with tools made for educational purpose: https://www.raylib.com/ I do write games…
    comment by stephc_int13 · 2019-09-21 · in Why I Write Games in C (yes, C)
  15. stb_image is widely used in games https://github.com/nothings/stb/blob/master/stb_image.h
  16. How does this compare to something like https://github.com/nothings/stb/blob/master/stb_image.h ? Is it just that it has more features and can handle weird edge cases?
  17. Here's a rationale for this from an author of very popular many single-header libraries: https://github.com/nothings/stb#why-single-file-headers As to how to use from two separate translation units - you need to define…
    comment by mmozeiko · 2019-08-08 · in MPEG1 Single file C library
  18. …for "bytes" if you want channel resolution, or leaving integers if you have 32bit pixel depth. https://github.com/nothings/stb/blob/master/stb_image.h#L120 https://wiki.libsdl.org/SDL_Surface
  19. I'm thinking of examples like this: https://github.com/nothings/stb/blob/master/stb_image.h It's a complete image loader library in a single header. This header contains everything I need to use that library: the entire documentation, the…
    comment by flohofwoe · 2019-05-27 · in Syntax highlighters are wrong (2014)
  20. ▲ 1
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2019-04-16 · 0 comments
  21. https://github.com/nothings/stb is another set of good header only libraries. (I'm not the author and don't know them, I'm just a happy user.)
  22. …ttps://github.com/NotCamelCase/RasterizationInOneWeekend 4: http://www.scratchapixel.com/index.php 5: https://github.com/nothings/stb/blob/master/stb_truetype.h 6: https://beej.us/guide/bgnet/ 7: https://github.com/search?q=http+parser&ref=…
    comment by emmanueloga_ · 2018-12-12 · in Let’s build a browser engine (2014)
  23. ▲ 2
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2018-12-01 · 0 comments
  24. …advantages as unity-builds (merging all sources into one file). PS: origin of the name "stb-style": https://github.com/nothings/stb (although I guess the general idea existed before)
  25. …of annoying that tables which are treated like arrays are 1-indexed by convention, though. [1]: https://github.com/nothings/stb
    comment by leggomylibro · 2018-09-12 · in Tables
  26. ▲ 2
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2018-06-17 · 0 comments
  27. …so you can have generic containers in C. For hash's, you can also look at klib's khash [5] [1] https://github.com/nothings/stb [2] https://github.com/attractivechaos/klib [3] https://github.com/nothings/stb/blob/master/stretchy_buffer....…
    comment by dottrap · 2018-06-03 · in One year of C
  28. Sean Barrett (who I think popularized the idea) has a FAQ on this ( https://github.com/nothings/stb ) where he justifies it by pointing at difficulties with deploying libraries on Windows. Which is a fair point, but by going straight to…
  29. ▲ 1
    STB: single-file public domain libraries for C/C++
    story by striking · 2018-01-13 · 0 comments
  30. ▲ 1
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2017-12-12 · 0 comments
  31. If you need a minimalist open-source font rendering library, look at stb_truetype: https://github.com/nothings/stb A single header file. Unfortunately it cannot do what harfbuzz or pango do, that is lay out complex scripts or do any layout
  32. ▲ 3
    Stb – Single-file public domain libraries for C/C++
    story by foob · 2017-09-26 · 0 comments
  33. …are the stb header-only libraries. There is a hash table implementation buried inside stb.h [4] https://github.com/nothings/stb
    comment by dottrap · 2017-08-23 · in Write a hash table in C
  34. ▲ 1
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2017-08-08 · 0 comments
  35. …WebAssembly. There is a growing trend of header-only libraries, especially the popular stb: https://github.com/nothings/stb#stb_libs and there is a growing list here: https://github.com/nothings/single_file_libs I consult to find tiny…
    comment by satoshinm · 2017-06-02 · in WebAssembly: Mozilla Won
  36. ▲ 2
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2017-05-04 · 0 comments
  37. these come to mind: https://github.com/nothings/stb https://github.com/nothings/single_file_libs
  38. …for redistributing libraries, but I've also found it useful to create these in my own projects. [0] https://github.com/nothings/stb
    comment by saticmotion · 2016-12-23 · in Building and Linking Libraries in C
  39. …another set of similar libraries called the STB Libraries, primarily aimed at gamedev/graphicsdev: https://github.com/nothings/stb
  40. ▲ 1
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2016-12-01 · 0 comments
  41. You can get good subpixel rendering from a single bitmap using a larger prefiltered glyph: https://github.com/nothings/stb/tree/master/tests/oversample
  42. …is a link to it on the wiki page. The change that I am most fond of is making it an stb-style ( https://github.com/nothings/stb/ ) header library.
    comment by networked · 2016-07-03 · in The Tcl War (1994)
  43. > stb_image.h For the record, this library is a single file with 6,755 (!) lines of code [1] [1] https://github.com/nothings/stb/blob/master/stb_image.h
  44. ▲ 11
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2016-05-23 · 6 comments
  45. …libs is probably the famous stb package [2]. - [1] https://bitbucket.org/rmitton/tigr/src - [2] https://github.com/nothings/stb
    comment by dmytroi · 2016-05-05 · in OS X app in plain C
  46. …They are small self-contained decoders for many common media formats, with excellent documentation: https://github.com/nothings/stb/blob/master/stb_image.h https://github.com/nothings/stb/blob/master/stb_truetype.h…
  47. Sean Barrett (of stb headers fame) has written about the reasons for header-only libraries here: https://github.com/nothings/stb/blob/master/docs/stb_howto.t... If compile-time is a concern (it isn't in my experience, at least if the rest…
    comment by flohofwoe · 2016-04-19 · in Nuklear: A small ANSI C GUI toolkit
  48. Yes! https://github.com/nothings/stb#why-single-file-headers
    comment by mmozeiko · 2016-04-19 · in Nuklear: A small ANSI C GUI toolkit
  49. …that comes to my head: For common utilities for game development stb libraries are fantastic: https://github.com/nothings/stb For general idea how to structure code you could google "data oriented design c++". Try not to structure your…
    comment by fsloth · 2016-02-01 · in Why I'm Choosing C++
  50. …can handle (similar to sqlite)? Because writing trivial scripts on Windows is also a pain? [1] https://github.com/nothings/stb [2] https://github.com/nothings/stb/blob/master/stb_c_lexer.h