linker error in 1.66 rc1 (regression from 1.65.1)
Hi, Using Visual Studio 2017 15.5, the following minimal test case causes a linker error with Boost 1.66 RC1 but builds fine with 1.65.1: Produces... 1>------ Build started: Project: aZ80, Configuration: Debug Win32 ------ 1>libboost_timer-vc141-mt-gd-x32-1_66.lib(cpu_timer.obj) : error LNK2005: "public: static class boost::chrono::time_point<class boost::chrono::steady_clock,class boost::chrono::duration<__int64,class boost::ratio<1,1000000000> > > __cdecl boost::chrono::steady_clock::now(void)" (?now@steady_clock@chrono@boost@@SA?AV?$time_point@Vsteady_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0DLJKMKAA@@boost@@@23@@23@XZ) already defined in libboost_chrono-vc141-mt-gd-x32-1_66.lib(chrono.obj) 1>libboost_timer-vc141-mt-gd-x32-1_66.lib(cpu_timer.obj) : error LNK2005: "double __cdecl boost::chrono::chrono_detail::get_nanosecs_per_tic(void)" (?get_nanosecs_per_tic@chrono_detail@chrono@boost@@YANXZ) already defined in libboost_chrono-vc141-mt-gd-x32-1_66.lib(chrono.obj) 1>C:\Projects\aZ80\vs\Debug\aZ80.exe : fatal error LNK1169: one or more multiply defined symbols found Swapping the order of the includes appears to workaround the problem. Mark. -- Sent from: http://boost.2283326.n4.nabble.com/Boost-Dev-f2600599.html
hmmm...the test case was removed from the post. Let's try again... -- Sent from: http://boost.2283326.n4.nabble.com/Boost-Dev-f2600599.html
Try again with a different browser! Minimal test case #include "boost\chrono.hpp" #include "boost\timer\timer.hpp" int main() { auto now = boost::chrono::steady_clock::now(); boost::timer::cpu_timer cput; return 0; } -- Sent from: http://boost.2283326.n4.nabble.com/Boost-Dev-f2600599.html
On 13 December 2017 at 08:11, Mark Incley via Boost <boost@lists.boost.org> wrote:
Try again with a different browser!
Minimal test case
#include "boost\chrono.hpp" #include "boost\timer\timer.hpp"
int main() { auto now = boost::chrono::steady_clock::now(); boost::timer::cpu_timer cput; return 0; }
Thanks for the report. I might be wrong, but the problem seems to be that some of the functions in <boost/chrono/detail/inlined/win/chrono.hpp> are not inline, but that shouldn't matter unless you're using BOOST_CHRONO_HEADER_ONLY. As you appear to be auto-linking the library, I wouldn't expect that to be the case. I'll see if I can recreate the error. Are you using the prebuilt binaries, or building the libraries yourself? And what build command are you using for this example?
Yes, I am auto-linking. We build the Boost libraries with a batch file that runs essentially the following (it builds 64-bit and dynamically linked versions too, which I've left out for brevity) bjam address-model=32 runtime-link=static toolset=msvc-14.1 -j%NUMBER_OF_PROCESSORS% --stagedir=./stage/x86 --without-python I used the following command (run from a VS2017 developer command prompt) with the test case: cl /EHsc /MTd /I"C:\ThirdPartySDK\boost_1_66_0_rc1" BoostLinkerError.cpp -link /LIBPATH:"C:\ThirdPartySDK\boost_1_66_0_rc1\stage\x86\lib" Cheers -- Sent from: http://boost.2283326.n4.nabble.com/Boost-Dev-f2600599.html
On 13 December 2017 at 10:03, Mark Incley via Boost <boost@lists.boost.org> wrote:
Yes, I am auto-linking. We build the Boost libraries with a batch file that runs essentially the following (it builds 64-bit and dynamically linked versions too, which I've left out for brevity)
bjam address-model=32 runtime-link=static toolset=msvc-14.1 -j%NUMBER_OF_PROCESSORS% --stagedir=./stage/x86 --without-python
I used the following command (run from a VS2017 developer command prompt) with the test case:
cl /EHsc /MTd /I"C:\ThirdPartySDK\boost_1_66_0_rc1" BoostLinkerError.cpp -link /LIBPATH:"C:\ThirdPartySDK\boost_1_66_0_rc1\stage\x86\lib"
Thanks, I'm still installing the binaries so I haven't checked yet, but I'm pretty sure that this triggered the error: https://github.com/boostorg/timer/commit/98954984a4b55d01380bd8f18c884dc8519... I'm not sure if it's best to revert that change, or fix it in chrono. I'll start a new thread to get the attention of the library maintainers.
participants (2)
-
Daniel James
-
Mark Incley