我从https://sourceforge.net/projects/boost/files/boost-binaries/1.65.0/获得了VC ++ 2010的Boost 64位Windows Installer(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 ==========
答案 0 :(得分:1)
我在Windows 7,x86上使用nuget包boost-vc100,版本1.65.1.0没有问题。