I'm trying to put an include guard around including
stb_image.h (from the well-known public domain image library).
I have noticed that, unusually, the include guard works inside the
.cpp file but not inside the header file.
Let me explain:
//This is something that stb image defines in its own include guard, so I should be able to test for it #ifndef STBI_INCLUDE_STB_IMAGE_H #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #endif
This gives me errors (multiple definitions of everything inside
stb_image.h), but the same code in
Texture.cpp does not give me an error.
Also, I'd like to note that this does not work either:
#ifndef WHOMST #define WHOMST #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #endif