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. …for inlining; whether the compiler actually decides to inline them is a different story. [1]: https://github.com/nothings/stb
  2. …in game development, is known among other things for still using visual c++ 6. [1] [0] https://github.com/nothings/stb [1] https://m.youtube.com/watch?v=nQrzB5P5NPE
    comment by justin66 · 2026-05-29 · in Let's compile Quake like it's 1997
  3. you may try https://github.com/nothings/stb/blob/master/stb_ds.h . a single header implementation for both dynamic array and string based hash table
    comment by alaaalawi · 2026-05-24 · in PHP's Oddities
  4. …benefit from it too, Sean "nothings" Barrett said that's the primary reason for his STB libraries. https://github.com/nothings/stb
  5. …single header with `#define CANVAS_ITY_IMPLEMENTATION`? I was inspired by the STB header ibraries ( https://github.com/nothings/stb ) and by libraries inspired by those, all of which I've found very convenient. In particular, I like their…
  6. You mean single file header only libraries. STB are the initials of the author of https://github.com/nothings/stb
  7. ▲ 3
    Stb: Single-file public domain libraries for C/C++
    story by pykello · 2025-09-28 · 0 comments
  8. …only libraries" can be exceptions to C code not being in header files. See STB as an example https://github.com/nothings/stb . The advantage theoretically is that you can #include this library and use its code and types from just one file,…
  9. …errors and why this is desirable. Look into stb lib, which in my opinion popularized this idea: https://github.com/nothings/stb?tab=readme-ov-file#how-do-i-...
  10. …other languages like JS and NPM? Maybe carefully choosing which dependencies you include is better? https://github.com/nothings/stb/blob/master/stb_truetype.h#L...
    comment by r1chardnl · 2025-04-23 · in Understand Your Dependencies
  11. …used pretty widely across game development codebases. and it supports a ton of different formats. https://github.com/nothings/stb
    comment by toastie_toastie · 2025-03-12 · in Fast-PNG: PNG image decoder and encoder
  12. Also relevant and useful single-file public domain libraries for C/C++ https://github.com/nothings/stb
  13. Nice, I didn’t know stb had a rect packer: https://github.com/nothings/stb/blob/master/stb_rect_pack.h
    comment by alex_suzuki · 2024-11-18 · in The Skyline algorithm for packing 2D rectangles
  14. ▲ 3
    Ask HN: Has Anyone Tried Single File Development with IDE Code Collapse?
    story by Decabytes · 2024-11-01 · 3 comments
  15. …the compress/decompress functionality can be make standard [1] https://github.com/SpartanJ/efsw [2] https://github.com/nothings/stb [3] https://github.com/jkuhlmann/cgltf [4] https://github.com/ocornut/imgui
    comment by alexvitkov · 2024-09-26 · in Rewriting Rust
  16. ▲ 1
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2024-02-28 · 0 comments
  17. …libraries I've used for game development - all in C/C++ - that you can piece together: General: stb https://github.com/nothings/stb 2D Phys: box2d https://box2d.org/ UI / Editor: imgui https://github.com/ocornut/imgui Platform: SDL…
  18. …of the implementation block in stb_image.h, above that is just "cheap" public API declarations: https://github.com/nothings/stb/blob/f4a71b13373436a2866c5d6...
  19. ▲ 85
    STB: Single-file public domain libraries for C/C++
    story by seansh · 2024-01-06 · 35 comments
  20. …used in Dear ImGUI). [1] https://handmade.network/forums/articles/t/7330-implementing... . [2] https://github.com/nothings/stb/blob/master/stb_truetype.h
    comment by signaru · 2024-01-01 · in Writing a TrueType font renderer
  21. …will outperform the fancy new bindless rendering. Some open source starting points for packing: https://github.com/nothings/stb/blob/master/stb_rect_pack.h https://github.com/ands/trianglepacker
    comment by animatethrow · 2023-11-13 · in Capturing the WebGPU Ecosystem
  22. The STB headers are mostly built like that: https://github.com/nothings/stb Dear ImGui is a C++ example: https://github.com/ocornut/imgui You could also add an optional 'convenience layer' over the lower-level flexible-but-inconvenient…
    comment by flohofwoe · 2023-09-24 · in Www which WASM works
  23. My stuff for instance: https://github.com/floooh/sokol ...inspired by: https://github.com/nothings/stb (here's how the sokol headers are integrated into a Zig project, note that there is only a build.zig which builds everything:…
    comment by flohofwoe · 2023-06-30 · in File for divorce from LLVM
  24. …up in the weeds with nothing to show for it but a tilemap class you've rewritten a dozen times. [0] https://github.com/nothings/stb
  25. …for the stuff I’ve made, when I have I just called stuff on the `Math` object in javascript. [1] https://github.com/nothings/stb/blob/master/stb_sprintf.h
    comment by david2ndaccount · 2023-04-13 · in Switching to C over 'Modern' Programming Languages
  26. The guy who developed stb_image writes all his software on Visual C++ 6 from 1998 https://github.com/nothings/stb > Why not C99? stdint.h, declare-anywhere, etc. > I still use MSVC 6 (1998) as my IDE because it has better human factors for…
    comment by shortrounddev · 2023-04-05 · in My long goodbye to Windows XP (2022)
  27. …for high performance tools when neither things like BMPs or things like PNG would suffice. [0] https://github.com/nothings/stb [1] https://github.com/richgel999/fpng/blob/main/src/fpng.cpp [2] https://github.com/jibsen/tinf/tree/master/src
    comment by SideQuark · 2023-01-19 · in Hello, PNG
  28. The most popular "header only" (or rather "single file" libs) are mostly written in C though: https://github.com/nothings/stb Important difference to typical C++ header-only libs: STB style libs don't use the inline keyword, but instead…
  29. …as a single translation unit, e.g., a single .c file). Here is but one famous collection of them: https://github.com/nothings/stb
  30. That’s not the case, if you take a bit of care. Look at STB for example ( https://github.com/nothings/stb ) -- I’ve successfully used STB functions on a bunch of different platforms. In both C and C++, even!
    comment by iainmerrick · 2022-07-23 · in Embed is in C23
  31. Even so, github does have a ton of very very popular C libraries(like https://github.com/nothings/stb ). I was bringing up the OS provided ones since they claimed not to be able to find any. My main point is that it is patently absurd to…
    comment by melissalobos · 2022-04-20 · in C Is Still Everywhere
  32. …and is probably influenced by the popular stb libraries[2]. [1] Actually a token stream. [2] https://github.com/nothings/stb
    comment by mananaysiempre · 2022-04-02 · in QOI – The Quite OK Image Format
  33. ▲ 2
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2022-03-07 · 0 comments
  34. …header file libraries that are larger and are very useful. Perfect example is the stb libraries: https://github.com/nothings/stb very widely used in the C / C++ community.
  35. …I was on the fence between doing .c/.h pair and a single .h. But finally took the inspiration from: https://github.com/nothings/stb .
  36. …://en.wikipedia.org/wiki/Wavefront_.obj_file [2] https://en.wikipedia.org/wiki/Netpbm#PPM_example [3] https://github.com/nothings/stb [4] https://github.com/ssloy/tinyraycaster/wiki/Part-4:-SDL [5] https://lazyfoo.net/tutorials/SDL/index.ph…
  37. …this means. Can you give an example? Is this being used in the above library? > PS: but also see: https://github.com/nothings/stb#why-single-file-headers OK, that only offers this explanation: > Why not two files, one a header and one an…
  38. …the extension header implementation after the base library implementation. PS: but also see: https://github.com/nothings/stb#why-single-file-headers
    comment by flohofwoe · 2021-11-24 · in QOI: Lossless Image Compression in O(n) Time
  39. …the entire library in a header file is a somewhat recent and much welcome trend. See for example: https://github.com/nothings/stb https://github.com/nothings/single_file_libs
  40. …libraries [2]. [1]: https://wiki.alopex.li/LetsBeRealAboutDependencies#gotta-go-... [2]: https://github.com/nothings/stb/blob/master/docs/stb_howto.t...
    comment by notriddle · 2021-11-18 · in Backdooring Rust crates for fun and profit
  41. …for PNG via stb_image_write [1]. [0] https://en.wikipedia.org/wiki/Netpbm#PAM_graphics_format [1] https://github.com/nothings/stb/blob/master/stb_image_write....
  42. ▲ 2
    Lessons learned about how to make a header-file library (2013)
    story by Tomte · 2021-07-07 · 0 comments
  43. …there's a reliance on constant-time algorithms, which this may not be well-suited to, however. [1] https://github.com/nothings/stb
    comment by andrewla · 2021-04-06 · in Wuffs’ PNG image decoder
  44. …[1], and, like you, I am always on the lookout for new things to add to the collection :) [0] https://github.com/nothings/stb [1] https://github.com/nothings/single_file_libs
    comment by _dps · 2021-03-21 · in ZPL: (Almost) C99 Powerkit
  45. For the general reasons. https://github.com/nothings/stb#why-single-file-headers
  46. Stretch Buffers in the stb header-only library: https://github.com/nothings/stb/blob/master/stretchy_buffer.... This basically allows you to use std::vector<T> like vectors in C, but with an added benefit that you can subscript the vector…
  47. There is now a big fat disclaimer at the top of the file saying basically the same thing: https://github.com/nothings/stb/blob/master/stb_truetype.h#L...
  48. …libs was actually that Windows doesn't have a default place where dependencies are installed: https://github.com/nothings/stb#why-single-file-headers
  49. …in this discussion, he has a good overview for how to create a robust single header library: https://github.com/nothings/stb/blob/master/docs/stb_howto.t... If you can offer some good arguments against those, instead of generic dogma, then…
  50. …define in exactly one place, like the list maintainer does in his own single header libraries: https://github.com/nothings/stb/blob/b42009b3b9d4ca35bc703f5...