-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Compile error when bit7z.lib is introduced into the project. #198
Comments
Hi!
Uhm strange, I can't seem to be able to replicate the issue. How are you including bit7z in your project? Do you link it via CMake or manually in a VS 2022 project?
Sorry, I can't get what you mean here. |
I use manually in a VS 2022 project,also references other third-party libraries, such as: zlib.lib, libcurl.lib, libeay32.lib, ssleay32.lib, alibabacloud-oss-cpp-sdk-static.lib, libwkhtmltox.lib, it is possible that a library with the latest version of the compilation of the It is possible that one of the libraries is conflicting with the latest version of the compiled static libraries in some places. I've also tried to write a simple demo to test referencing the latest bit7z compiled libraries, and it compiles fine, but when I referenced it to my existing project, it reported a compilation error. Currently I can only retreat to the second best to use back to the date of the old a little bit of source code compiled out of static libraries. |
Thanks for the additional details! |
Unfortunately, I cannot replicate the problem. I have created a small C++20 demo project in VS 2022 which links all the libraries you mentioned, and which uses the latest bit7z version (i.e., v4.0.6) built separately always with the same VS 2022, C++17. Are you building bit7z and your project with the exact same version of Visual Studio 2022? #include "bit7z/bitarchivereader.hpp"
#include "zlib.h"
#include "curl/curl.h"
#include "alibabacloud/oss/OssClient.h"
#include "openssl/ssl.h"
#include "wkhtmltox/pdf.h"
#include <format>
#include <iostream>
auto main() -> int {
using namespace bit7z;
try {
Bit7zLibrary lib{};
BitArchiveReader reader{ lib, "./test.zip", BitFormat::Zip };
for ( const auto& item : reader ) {
std::cout << std::format( "[{}] {} (size: {})", item.index(), item.path(), item.size() ) << std::endl;
}
} catch ( const BitException& ex ) {
std::cerr << std::format( "Error: {}", ex.what() ) << std::endl;
}
std::cout << std::format( "zlib version: {}", zlibVersion() ) << std::endl;
curl_version_info_data* ver = curl_version_info( CURLVERSION_NOW );
std::cout << std::format( "curl version: {}.{}.{}",
( ver->version_num >> 16 ) & 0xff,
( ver->version_num >> 8 ) & 0xff,
ver->version_num & 0xff ) << std::endl;
std::string alibaba = "alibaba";
std::string alibaba_md5 = AlibabaCloud::OSS::ComputeContentMD5( alibaba.c_str(), alibaba.size() );
std::cout << "alibaba MD5: " << alibaba_md5 << std::endl;
SSL_library_init();
std::cout << std::format( "openssl version: {}", SSLeay_version( SSLEAY_VERSION ) ) << std::endl;
std::cout << std::format( "wkhtmltox version: {}", wkhtmltopdf_version() ) << std::endl;
return EXIT_SUCCESS;
} |
First of all, thanks for your answer, because my project is quite big, maybe there are other factors affecting the compilation error reporting problem. I myself have tried to write a small demo to introduce the latest bit7z to test the compilation is no problem. I am using vs2022 with C++20 standard. |
Uhm, okay. Yeah, I think there may be some other settings in your project that could cause this issue. One option that could result in a similar issue is the What compilation options of MSVC are you using in your project? |
None of the possibilities you describe are available on my end.At a later stage, is it possible to consider adding a dynamic library (dll) build to meet different needs, which also avoids the problem of setting up various parameters for static libraries. |
So building bit7z with
Bit7z is a static-only library because it's already a library used to dynamically link to another library (7-Zip). If it were compiled as a dynamic library, you would have your program dynamically link to a library (bit7z) to dynamically link to another library (7-Zip). Maybe in the future I will add the possibility to include the whole 7-Zip source code directly into the library. In this case, dynamically linking bit7z will make much more sense. |
My projects including bit7z and 3rd party libraries are compiled with the /MD option! |
1 similar comment
My projects including bit7z and 3rd party libraries are compiled with the /MD option! |
Ah, I see. Thank you for the detail. |
Hello, I recently upgraded to bit7z V4.0.8 and recompiled the library, replacing the files in the new include folder. After integrating it into my project, everything compiles successfully now. Since my Visual Studio project uses C++23, I made the following modification in the auto read_symlink_as_string( const fs::path& symlinkPath ) noexcept -> std::string {
std::error_code error;
fs::path result = fs::read_symlink(symlinkPath, error);
std::u8string u8_str = result.u8string();
return std::string(u8_str.begin(), u8_str.end());
} Thank you for your significant update, which allowed my project to reference your code again. |
bit7z version
4.0.x
Compilation options
BIT7Z_PATH_SANITIZATION, BIT7Z_USE_NATIVE_STRING
7-zip version
v23.01
7-zip shared library used
7z.dll / 7z.so
Compilers
MSVC
Compiler versions
vs 2022
Architecture
x86
Operating system
Windows
Operating system versions
win 10 X64
Bug description
bit7z.lib I compiled with vs 2022 C++17 x86, introduced into my existing project which is C++20 x86, compilation does not pass!
The source code I used from December 22, 2023 is the one that compiles the .lib to my existing project and it compiles!
Steps to reproduce
No response
Expected behavior
No response
Relevant compilation output
Code of Conduct
The text was updated successfully, but these errors were encountered: