Solved QuaZip - Undefined Reference
-
Windows or linux ?
-
@mrjj Win10
-
@FluentCoding
Ok did you see
"Also note that you may or may not need to define ZLIB_WINAPI (qmake DEFINES+=ZLIB_WINAPI) when linking to zlib on Windows, depending on how zlib was built (generally, if using zlibwapi.dll, this define is needed)."From where did you install zlib ?
-
@mrjj From their homepage (the *.msi installer)
-
@FluentCoding
https://zlib.net/ ?
and then some of external links ?I wondering if its for older compiler if not source code.
-
No, don't think so. Have you ever worked with QuaZip? Or are you aware of any good alternative? I was unlucky with KArchive too.
-
@FluentCoding
I only seen it here on forums. I compiled it once in linux but not tried on
Windows hence my questions to see what zlib you used.
if binary, i think its a compiler mismatch issue you are seeing.I used
https://github.com/kuba--/zip
which is very small and easy to use/compile but
only support zip files.
But for my use case it was ok and speed and compression is super. -
@mrjj Thats perfect, thanks! I only need it for zip iirc.
-
@FluentCoding
Ok :)
Do note.It has no recursive function to add all files in all folders but using Qt that is not hard to add.
I tested it with a 1 GB zip file which it handled ok. I cannot say for larger.
It does not support 64 bit zip file so if you get yours from an external source it might be an issue.
-
Oh aight. Btw is it possible to open a zip file from a QByteArray (from memory generally)? @mrjj
-
@FluentCoding said in QuaZip - Undefined Reference:
Btw is it possible to open a zip file from a QByteArray (from memory generally)?
yes
-
@Christian-Ehrlicher How, if I may ask? I haven't found the appropiate method for that.
-
@FluentCoding
Hi
Yes it can be both memory and file-based
see section
Extract a zip entry into memory using callback. -
This post is deleted! -
@mrjj Thanks but I meant from memory, not into memory.
-
@FluentCoding
if you mean
Can i add a buffer to the zip file as was it a file then yes :)auto bytes = QByteArray::fromRawData(reinterpret_cast<const char *>(memory), int(fileSize32Bit)); zip_entry_write(zip, bytes, fileSize32Bit);
-
@mrjj Alright - (hopefully the) last question: How can I create zip_t object without
zip_open
, so that i only usezip_entry_write
to add the buffer? Should I just create an object of the structzip_t
? Also, should I replacefileSize32Bit
with the size of the QByteArray? -
Hi
I have not tried that but look in zip.c andstruct zip_t *zip_open(const char *zipname, int level, char mode) {
I think you can init it up as you like if you follow that code and the various modes + flags.
Yes, fileSize32Bit should be the QByteArray size.
-
Alright, but I think that I'll try another framework :/ It seems that I can run into problems - im neither sure if the zip files i wanna extract are 32 bit and maybe, I would need to extract a .rar or .7z later. I will give Zipper a try. But thank you very much for your support, @mrjj.
-
@FluentCoding
Hi
Ok. Please post if you find something good that is easy to compile on windows.
Also, could you pos the link for the zlib you used ?
I cannot find any MSI and Im still abit hooked on QuaZip :)