Browse Source

readme: Add "how to use these libs" section

Try to be a bit more explicit still.

Fixes issue #903, or so I hope.
Fabian Giesen 4 years ago
parent
commit
ba739e54ed
1 changed files with 18 additions and 0 deletions
  1. 18 0
      README.md

+ 18 - 0
README.md

@@ -49,6 +49,24 @@ Total lines of C code: 56524
 FAQ
 ---
 
+#### How do I use these libraries?
+
+The idea behind single-header file libraries is that they're easy to distribute and deploy
+because all the code is contained in a single file. By default, the .h files in here act as
+their own header files, i.e. they declare the functions contained in the file but don't
+actually result in any code getting compiled.
+
+So in addition, you should select _exactly one_ C/C++ source file that actually instantiates
+the code, preferably a file you're not editing frequently. This file should define a
+specific macro (this is documented per-library) to actually enable the function definitions.
+For example, to use stb_image, you should have exactly one C/C++ file that doesn't
+include stb_image.h regularly, but instead does
+
+    #define STB_IMAGE_IMPLEMENTATION
+    #include "stb_image.h"
+
+The right macro to define is pointed out right at the top of each of these libraries.
+
 #### What's the license?
 
 These libraries are in the public domain. You can do anything you