What does #define STB_IMAGE_IMPLEMENTATION do in stb_image

58 views Asked by At

I am trying to use stb_image to load image files as textures in an OpenGL program, the documentation of the header file stb_image.h states the following:

"Do this:

#define STB_IMAGE_IMPLEMENTATION

before you include this file in one C or C++ file to create the implementation."

What does this type of preprocessor directive actually do?

For the benefit of the reader, here is how my project is structured.

  1. main.cpp
  2. stb_image.h

The header of the main.cpp file looks likes this:

#include <iostream>
#include <glad/glad.h>
#include <glfw3.h>
#include "shader.h"

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
0

There are 0 answers