Skip to content

Fixed duplicated symbols#11

Open
kstenschke wants to merge 1 commit intotfussell:masterfrom
kstenschke:patch-2
Open

Fixed duplicated symbols#11
kstenschke wants to merge 1 commit intotfussell:masterfrom
kstenschke:patch-2

Conversation

@kstenschke
Copy link

Using miniz-cpp from multiple translation units caused linker error.
Done: marked declarations as static for correct linking from multiple translation units.

Using miniz-cpp from multiple translation units caused linker error.
Done: marked declarations as static for correct linking from multiple translation units.
@yhyu13
Copy link

yhyu13 commented Mar 9, 2021

@kstenschke thanks, this is helpful

@wzel
Copy link

wzel commented Feb 4, 2023

Greetings from the GNU Guix community. Merging this pull request would help us in packaging docxBox. Guix issue tracker reference here. Thanks for considering the merge.

@tope99
Copy link

tope99 commented Nov 22, 2025

I think a better approach is to #define MINIZ_HEADER_FILE_ONLY everywhere so only declarations get included. Then in one file include it with that macro #undefed. This is similar to how stb libraries are used. However:

  1. For some reason the macro works in the opposite way - in stb you only #define it once before you include the implementation not every time when you include interface. This seems to be more verbose.

  2. Last part of zip_file.h is not guarded with this macro so you still get duplicated symbols.

Sadly I can't use miniz-cpp in its current form. It needs to be patched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants