Multiple defined symbols
Hi, I have a "dll" project which is dependent on boost libraries like thread and system. When I compile my project I gen error like libboost_thread-vc120-mt-gd-1_57.lib(thread.obj) : error LNK2005: "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UAE@XZ) already defined in boost_thread-vc120-mt-gd-1_57.lib(boost_thread-vc120-mt-gd-1_57.dll) What I understood from this error is, my project is trying to link to both dynamic and static boost libraries. I only want to link to the boost thread dll. To my knowledge am not directly using any boost autolink feature. In the visual studio linking option I have mentioned only the "boost_thread-vc120-mt-gd-1_57.lib". Why could it be trying to link to libboost_thread-vc120-mt-gd-1_57.lib? Is there any way to find where this is happening? Thanks, Lloyd
AMDG On 04/08/2015 04:59 AM, Lloyd wrote:
Hi,
I have a "dll" project which is dependent on boost libraries like thread and system. When I compile my project I gen error like
libboost_thread-vc120-mt-gd-1_57.lib(thread.obj) : error LNK2005: "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UAE@XZ) already defined in boost_thread-vc120-mt-gd-1_57.lib(boost_thread-vc120-mt-gd-1_57.dll)
What I understood from this error is, my project is trying to link to both dynamic and static boost libraries. I only want to link to the boost thread dll.
You need -DBOOST_ALL_DYN_LINK.
To my knowledge am not directly using any boost autolink feature.
Autolink is activated by including boost headers.
In the visual studio linking option I have mentioned only the "boost_thread-vc120-mt-gd-1_57.lib". Why could it be trying to link to libboost_thread-vc120-mt-gd-1_57.lib? Is there any way to find where this is happening?
In Christ, Steven Watanabe
Along these lines, I have been having the opposite problem on Mac -- trying to link only with static libraries and getting the dynamic libraries instead. What are the magic words there? Something like -DBOOST_NO_DYN_LINK, -DBOOST_ALL_LIB_LINK ??? I have to don't understand why it would ever be advantageous for any library to autolink behind the programmer's back. I'm sure there must be a reason, though. On 4/8/2015 9:53 AM, Steven Watanabe wrote:
AMDG
On 04/08/2015 04:59 AM, Lloyd wrote:
Hi,
I have a "dll" project which is dependent on boost libraries like thread and system. When I compile my project I gen error like
libboost_thread-vc120-mt-gd-1_57.lib(thread.obj) : error LNK2005: "public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UAE@XZ) already defined in boost_thread-vc120-mt-gd-1_57.lib(boost_thread-vc120-mt-gd-1_57.dll)
What I understood from this error is, my project is trying to link to both dynamic and static boost libraries. I only want to link to the boost thread dll. You need -DBOOST_ALL_DYN_LINK.
To my knowledge am not directly using any boost autolink feature.
Autolink is activated by including boost headers.
In the visual studio linking option I have mentioned only the "boost_thread-vc120-mt-gd-1_57.lib". Why could it be trying to link to libboost_thread-vc120-mt-gd-1_57.lib? Is there any way to find where this is happening?
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
AMDG On 04/08/2015 12:30 PM, David Medine wrote:
Along these lines, I have been having the opposite problem on Mac -- trying to link only with static libraries and getting the dynamic libraries instead. What are the magic words there? Something like
-DBOOST_NO_DYN_LINK, -DBOOST_ALL_LIB_LINK ???
There is no autolinking on OSX. If the linker is finding the wrong library, you'll need to change the link command to search for a static library, instead.
I have to don't understand why it would ever be advantageous for any library to autolink behind the programmer's back. I'm sure there must be a reason, though.
autolink always chooses the library that matches your build settings. It's very easy to get this wrong if you're linking manually. In Christ, Steven Watanabe
I was using a wrong directive "BOOST_ALL_DYN_DLL" instead of the
correct "BOOST_ALL_DYN_LINK".
Thanks a lot for your valuable help.
On Thu, Apr 9, 2015 at 12:15 AM, Steven Watanabe
AMDG
On 04/08/2015 12:30 PM, David Medine wrote:
Along these lines, I have been having the opposite problem on Mac -- trying to link only with static libraries and getting the dynamic libraries instead. What are the magic words there? Something like
-DBOOST_NO_DYN_LINK, -DBOOST_ALL_LIB_LINK ???
There is no autolinking on OSX. If the linker is finding the wrong library, you'll need to change the link command to search for a static library, instead.
I have to don't understand why it would ever be advantageous for any library to autolink behind the programmer's back. I'm sure there must be a reason, though.
autolink always chooses the library that matches your build settings. It's very easy to get this wrong if you're linking manually.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
David Medine
-
Lloyd
-
Steven Watanabe
-
Алексей Филиппов