richgel999 / miniz

miniz: Single C source file zlib-replacement library, originally from code.google.com/p/miniz
MIT License
2.2k stars 322 forks source link

How do I use this library? #285

Closed rdutta closed 1 year ago

rdutta commented 1 year ago

This is a configuration error on my part but I can't figure it out.

LNK2001: unresolved external symbol mz_zip_reader_end
LNK2001: unresolved external symbol mz_free
LNK2001: unresolved external symbol mz_zip_reader_extract_file_to_heap
LNK2001: unresolved external symbol mz_zip_reader_init_file

I have downloaded miniz.h and miniz.c from the release miniz-3.0.2.zip (i.e. the amalgamation). Both are in a directory that is on my include path (using VS2022). In my project I #include <miniz.h> and there are no intellisense errors. The header also mentions:

   * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the
     below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it.
rdutta commented 1 year ago

I realized all my other imports were header only libraries, so I had to add miniz.c to the solution for the linker to find it.