rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
602 stars 110 forks source link

[build-error]: Failed to open the archive file: No such process #185

Closed MarkShaw7486 closed 3 months ago

MarkShaw7486 commented 6 months ago

I linked bit7z to my project in Code::Blocks v20.03 and compiled for C++17 with MinGW-w64. First, I am getting no tooltips for any bit7z functionality. I am unsure if this is from an incorrect link, or what may be causing the issue there. Second, no matter what library function I try to implement, I get the following error code in the console: Failed to open the archive file: No such process

ex.what() gives no error codes whatsoever, and I am unsure what may be wrong.

I am on Windows 10, I linked bit7z 4.0.5 MinGW64, and I have 7z.dll.

I can provide any more information you may need. This looks like an easy to use and great library, and would really like to implement its functionality into my project.

MarkShaw7486 commented 6 months ago

Update: you can close this. The issue was in the way I was handling the 7z file. I didn't understand how the internal directories of the file structure worked. After some extensive reading, I realized I was pointing at the wrong part of the file and bit7z obviously couldn't find the file where it didn't exist! It works now.

Thank you for this wonderful and simple wrapper!

rikyoz commented 6 months ago

Hi! I'm sorry for not getting back to you sooner.

The issue was in the way I was handling the 7z file. I didn't understand how the internal directories of the file structure worked. After some extensive reading, I realized I was pointing at the wrong part of the file and bit7z obviously couldn't find the file where it didn't exist! It works now.

To be fair, the error message does not clearly explain what problem caused the exception. In particular, the "No such process" part is not correct. It is probably a result of MinGW's stream classes not setting the last error using the Windows API, in contrast with bit7z expecting to read the error via the GetLastError WinAPI function.

I'll leave the issue open as a reminder and work on fixing the error message in the next patch version of the library!

Thank you for this wonderful and simple wrapper!

You're welcome! Thank you for using it! 🙏