【问题标题】:Can Boost 1.65.x be used with Visual C++ 2010?Boost 1.65.x 可以与 Visual C++ 2010 一起使用吗?
【发布时间】:2017-10-14 08:33:00
【问题描述】:

我从https://sourceforge.net/projects/boost/files/boost-binaries/1.65.0/ 获得了适用于 VC++ 2010 的 Boost 64 位 Windows 安装程序 (boost_1_65_0-msvc-10.0-64.exe)。

项目中的Include和Library路径设置正确。

尝试在 x64 控制台项目中使用它会导致几个构建错误 - 我在这里只使用线程类。这些是我得到的错误:

1>------ Build started: Project: CPSS, Configuration: Debug x64 ------
1>  stdafx.cpp
1>  SockServer.cpp
1>  Linking to lib file: libboost_thread-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_date_time-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_system-vc100-mt-gd-1_65.lib
1>E:\hld\Src\Boost\boost_1_65_0\boost/system/error_code.hpp(255): warning C4355: 'this' : used in base member initializer list
1>  Linking to lib file: libboost_chrono-vc100-mt-gd-1_65.lib
1>  CPSS.cpp
1>  Linking to lib file: libboost_thread-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_date_time-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_system-vc100-mt-gd-1_65.lib
1>E:\hld\Src\Boost\boost_1_65_0\boost/system/error_code.hpp(255): warning C4355: 'this' : used in base member initializer list
1>  Linking to lib file: libboost_chrono-vc100-mt-gd-1_65.lib
1>E:\hld\Src\Boost\boost_1_65_0\boost/thread/detail/thread.hpp(271): error C2752: 'boost::move_detail::remove_reference<T>' : more than one partial specialization matches the template argument list
1>          with
1>          [
1>              T=int (__cdecl &)(void)
1>          ]
1>          E:\hld\Src\Boost\boost_1_65_0\boost/move/detail/meta_utils.hpp(105): could be 'boost::move_detail::remove_reference<T&&>'
1>          E:\hld\Src\Boost\boost_1_65_0\boost/move/detail/meta_utils.hpp(97): or       'boost::move_detail::remove_reference<T&>'
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxshared(13) : see reference to function template instantiation 'boost::thread::thread<int(__cdecl &)(void)>(F)' being compiled
1>          with
1>          [
1>              F=int (__cdecl &)(void)
1>          ]
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxshared(35) : see reference to function template instantiation 'std::tr1::_Ref_count_obj<_Ty>::_Ref_count_obj<int(__cdecl &)(void)>(_Arg0)' being compiled
1>          with
1>          [
1>              _Ty=thread_t,
1>              _Arg0=int (__cdecl &)(void)
1>          ]
1>          CPSS.cpp(34) : see reference to function template instantiation 'std::tr1::shared_ptr<_Ty> std::tr1::make_shared<thread_t,int(__cdecl &)(void)>(_Arg0)' being compiled
1>          with
1>          [
1>              _Ty=thread_t,
1>              _Arg0=int (__cdecl &)(void)
1>          ]
1>E:\hld\Src\Boost\boost_1_65_0\boost/thread/detail/thread.hpp(271): error C2668: 'boost::forward' : ambiguous call to overloaded function
1>          E:\hld\Src\Boost\boost_1_65_0\boost/move/utility_core.hpp(252): could be 'T boost::forward<F>(int (__cdecl &)(void))'
1>          with
1>          [
1>              T=int (__cdecl &)(void),
1>              F=int (__cdecl &)(void)
1>          ]
1>          E:\hld\Src\Boost\boost_1_65_0\boost/move/utility_core.hpp(248): or       'T boost::forward<F>(int (__cdecl &)(void))'
1>          with
1>          [
1>              T=int (__cdecl &)(void),
1>              F=int (__cdecl &)(void)
1>          ]
1>          while trying to match the argument list '(int (__cdecl &)(void))'
1>  SockServerEx.cpp
1>  Linking to lib file: libboost_thread-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_date_time-vc100-mt-gd-1_65.lib
1>  Linking to lib file: libboost_system-vc100-mt-gd-1_65.lib
1>E:\hld\Src\Boost\boost_1_65_0\boost/system/error_code.hpp(255): warning C4355: 'this' : used in base member initializer list
1>  Linking to lib file: libboost_chrono-vc100-mt-gd-1_65.lib
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

【问题讨论】:

    标签: visual-studio-2010 boost


    【解决方案1】:

    我在 windows 7 x86 上使用 nuget 包 boost-vc100,版本 1.65.1.0 没有问题。

    【讨论】:

    • 注意nuget包需要VS2010 sp1
    猜你喜欢
    • 2016-01-27
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    • 1970-01-01
    • 2011-11-25
    • 2013-09-23
    • 1970-01-01
    相关资源
    最近更新 更多