11Zip icon indicating copy to clipboard operation
11Zip copied to clipboard

Build errors (with fix ready)

Open toodemhard opened this issue 5 months ago • 0 comments

I encountered 2 errors while trying to build this. The first was a cmake error in zlib's CMakelists.txt which minizip-ng fixed in zlib-ng/minizip-ng#764

CMake Error in extlibs/minizip/third-party/zlib/CMakeLists.txt:
  Target "zlibstatic" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/toodemhard/kms/11Zip/build/_deps/zlib-build"

  which is prefixed in the build directory.

After I checked out latest in minizip-ng, this error was solved.

The second error was in src/unzipper.cpp

C:/Users/toodemhard/kms/11Zip/src/unzipper.cpp:85:23: error: no matching function for call to 'unzLocateFile'
   85 |             int err = unzLocateFile(zipFile_, filename.data(), nullptr);
      |                       ^~~~~~~~~~~~~
C:/Users/toodemhard/kms/11Zip/extlibs\minizip/mz_compat.h:368:17: note: candidate function not viable: no known conversion from 'std::nullptr_t' to 'unzFileNameCase' (aka 'int') for 3rd argument
  368 | ZEXPORT int     unzLocateFile(unzFile file, const char *filename, unzFileNameCase filename_case);
      |                 ^                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

For some reason at e68e20d9438b58f2c50ea42854f5f97256554a57 it was changed from passing 0 to passing nullptr as int?

-            int err = unzLocateFile(zipFile_, filename, 0);
+            int err = unzLocateFile(zipFile_, filename.data(), nullptr);

After I changed it to pass 0, it compiles with no errors. Should I make a pull request?

toodemhard avatar Sep 21 '24 19:09 toodemhard