bcdec icon indicating copy to clipboard operation
bcdec copied to clipboard

Remove implementation from include guard

Open Puxtril opened this issue 2 years ago • 0 comments

I'm having issues adding this to my C++ project. Here's the issues I'm running into:

I have files TextureConverter.h and TextureConverter.cpp. Naturally, TextureConverter.cpp includes TextureConverter.h. I'm including bcdec.h in my header and defining BCDEC_IMPLEMENTATION. Problem is, this defines bcdec's implementation wherever TextureConverter.h is included, so this leads to mutiple definition compiler errors. So my workaround is to include bcdec.h in both TextureConverter.h and TextureConverter.cpp, but only define BCDEC_IMPLEMENTATION in the source file. The catch is, bcdec.h wraps its implementation inside the include guard, so including TextureConverter.h in my source prevents me from including bcdec again. To me, it seems the include guard should only wrap the definition, not the implementation.

That was a long justification for my one-line change. I can open a pull request if you think this will be beneficial.

Puxtril avatar Apr 14 '24 16:04 Puxtril