[英]MSYS2 MinGW strange multiple definition of boost::exception_detail::clone_impl when building large application
I'm trying to build a fairly large application that works fine on Linux with MSYS2.我正在尝试构建一个相当大的应用程序,该应用程序可以在带有 MSYS2 的 Linux 上正常工作。 I've almost got it to build but I'm now getting a pretty odd linker error:
我几乎可以构建它,但我现在遇到了一个非常奇怪的 linker 错误:
The error is something about having multiple definitions of boost::exception_detail::clone_impl
, boost is used in the project but no boost exception stuff is never directly used.该错误与
boost::exception_detail::clone_impl
的多个定义有关,项目中使用了 boost,但从未直接使用任何 boost 异常的东西。
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: feedback.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): multiple definition of `non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()'; api.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev[_ZThn64_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEED1Ev]+0x0): first defined here
(the objects it mentions don't directly use boost anywhere -- except for one line that uses boost::iequals
). (它提到的对象在任何地方都没有直接使用 boost - 除了使用
boost::iequals
的一行)。
What could cause this?什么可能导致这种情况? I don't really know what clone_impl is or why I'd have duplicates of it.
我真的不知道 clone_impl 是什么,也不知道为什么要复制它。 It seems MinGW specific.
似乎是 MinGW 特有的。
I faced a similar issue when using MinGW and Code::Blocks.我在使用 MinGW 和 Code::Blocks 时遇到了类似的问题。 Rebuilding the project solved that problem for me.
重建项目为我解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.