Skip to content
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

[abseil] LNK2005 linker errors with C++/CLI project #44016

Open
chriche-ms opened this issue Feb 25, 2025 · 2 comments
Open

[abseil] LNK2005 linker errors with C++/CLI project #44016

chriche-ms opened this issue Feb 25, 2025 · 2 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@chriche-ms
Copy link
Member

Operating system

Windows

Compiler

MSVC

Steps to reproduce the behavior

1. Create a simple C++/CLI console program using the VS template
2. Add vcpkg support
3. Add abseil dependency
4. Build and observe LNK2005 linker errors

Failure logs

Build started at 14:01...
1>------ Build started: Project: TestVcpkg, Configuration: Debug x64 ------
1>TestVcpkg.cpp
1>.NETFramework,Version=v4.7.2.AssemblyAttributes.cpp
1>Generating Code...
1>TestVcpkg.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
1>MSVCRTD.lib(throw_bad_alloc.obj) : error LNK2005: "public: __cdecl std::bad_alloc::bad_alloc(class std::bad_alloc const &)" (??0bad_alloc@std@@qeaa@AEBV01@@z) already defined in abseil_dll.lib(abseil_dll.dll)
1>MSVCRTD.lib(throw_bad_alloc.obj) : error LNK2005: "public: __cdecl std::bad_array_new_length::bad_array_new_length(class std::bad_array_new_length const &)" (??0bad_array_new_length@std@@qeaa@AEBV01@@z) already defined in abseil_dll.lib(abseil_dll.dll)
1>MSVCRTD.lib(throw_bad_alloc.obj) : error LNK2005: "public: __cdecl std::exception::exception(class std::exception const &)" (??0exception@std@@qeaa@AEBV01@@z) already defined in abseil_dll.lib(abseil_dll.dll)
1>MSVCRTD.lib(throw_bad_alloc.obj) : error LNK2005: "public: virtual __cdecl std::bad_array_new_length::~bad_array_new_length(void)" (??1bad_array_new_length@std@@UEAA@XZ) already defined in abseil_dll.lib(abseil_dll.dll)
1>MSVCRTD.lib(throw_bad_alloc.obj) : error LNK2005: "public: virtual char const * __cdecl std::exception::what(void)const " (?what@exception@std@@UEBAPEBDXZ) already defined in abseil_dll.lib(abseil_dll.dll)
1>C:\Code\TestVcpkg\x64\Debug\TestVcpkg.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Done building project "TestVcpkg.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 14:01 and took 02.922 seconds ==========

Additional context

No response

@chriche-ms chriche-ms added the category:port-bug The issue is with a library, which is something the port should already support label Feb 25, 2025
@Mengna-Li
Copy link
Contributor

I did not reproduce this issue on x64-windows. Which triplet are you using? Please provide a simple example also. Thanks.

@chriche-ms
Copy link
Member Author

This is using the x64-windows triplet. I have a minimal repro, just need to figure out how to clean all the vcpkg buildtrees etc. to get the size down enough to share...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

2 participants