-
-
Notifications
You must be signed in to change notification settings - Fork 120
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]: Multiple Definition Linker Error for IID_IUnknown #193
Comments
This fixes the issue for me. File #ifndef _MSC_VER
+#ifndef __MINGW32__
extern const GUID IID_IUnknown;
+#endif
#endif File #ifndef _MSC_VER
+#ifndef __MINGW32__
const GUID IID_IUnknown = {
0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 }
};
+#endif
#endif |
Hi! cmake_minimum_required( VERSION 3.28 )
project( test_uuid_mingw )
set( CMAKE_CXX_STANDARD 17 )
add_executable( test_uuid_mingw main.cpp )
include( cmake/Dependencies.cmake )
CPMAddPackage(
NAME bit7z
GIT_REPOSITORY "https://github.com/rikyoz/bit7z.git"
GIT_TAG master
OPTIONS
"BIT7Z_BUILD_TESTS false"
"BIT7Z_BUILD_DOCS false"
)
target_link_libraries(${PROJECT_NAME} PRIVATE bit7z)
#include <bit7z/bit7zlibrary.hpp>
#include <bit7z/bitmemcompressor.hpp>
int main() {
bit7z::Bit7zLibrary lib{};
bit7z::BitMemCompressor compressor{lib, bit7z::BitFormat::Zip};
compressor.compressFile({'h', 'e', 'l', 'l', 'o'}, "hello.zip");
return 0;
}
|
That is really strange, let me try to create a reproducer. |
This main file fails: Usage of
|
Looks like this chain: But I am not sure TBH, couldn't get a smaller reproducer. |
I see. Thank you for the reproducer!
I remember fixing this exact issue some years ago (24706ff), but that same fix is causing your issue. |
I just pushed a fix to the branch if( MINGW )
target_link_libraries( ${LIB_TARGET} PUBLIC uuid )
endif() This way, a project using bit7z will link against |
@rikyoz Works as expected! Thanks a lot. 👍🏼 |
Perfect! You're welcome! 👍🏼 |
Released on |
bit7z version
4.0.x
Compilation options
No response
7-zip version
v23.01
7-zip shared library used
7z.dll / 7z.so
Compilers
MinGW
Compiler versions
MinGW 11.0 w64, bundles in CLion IDE, GCC 13.1.0
Architecture
x86_64
Operating system
Windows
Operating system versions
Windows 11
Bug description
The linker fails with a "multiple definition" error for
IID_IUnknown
. This symbol conflict arises becauseIID_IUnknown
is defined both in the bit7z library (libbit7z64_d.a) and MinGW'slibuuid.a
.Steps to reproduce
Nothing special, just added as following in CMake:
Expected behavior
No response
Relevant compilation output
The text was updated successfully, but these errors were encountered: