VS2017: boost binaries with WinXP support?

时间:2018-07-25 05:06:57

标签: c++ visual-c++ boost visual-studio-2017

I've recently upgraded Visual Studio from 2013 (msvc-12.0) to 2017 (msvc-14.1), and updated boost to 1.66 to take advantage of the prebuilt binaries. However I do have projects that need to support Windows XP, and I found this note at https://sourceforge.net/projects/boost/files/boost-binaries/

1.59.0/ - support of msvc-14.0 (libraries built with msvc-14.0 do not support windows XP)

What are my options? Do I need to build my own XP binaries somehow (e.g. with v141_xp toolset)? I have no experience with building boost, so if it's necessary, any pointers to configuring it would be appreciated.


As an aside, I've tried compiling with 1.66 binaries anyway, and naturally got lots of linker errors like the following: (note the v2s_mt_nt5 namespace)

5>ImageRegisterLib.lib(testDefs.obj) : error LNK2001: unresolved external symbol "private: void __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::rollback(void)" (?rollback@once_block_sentry@aux@v2s_mt_nt5@log@boost@@AAEXXZ)
5>ImageRegisterLib.lib(testDefs.obj) : error LNK2001: unresolved external symbol "private: bool __thiscall boost::log::v2s_mt_nt5::aux::once_block_sentry::enter_once_block(void)const " (?enter_once_block@once_block_sentry@aux@v2s_mt_nt5@log@boost@@ABE_NXZ)
5>ImageRegisterLib.lib(testDefs.obj) : error LNK2001: unresolved external symbol "private: static unsigned int __cdecl boost::log::v2s_mt_nt5::attribute_name::get_id_from_string(char const *)" (?get_id_from_string@attribute_name@v2s_mt_nt5@log@boost@@CAIPBD@Z)
5>ImageRegisterLib.lib(testDefs.obj) : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::message(void)" (?message@default_attribute_names@aux@v2s_mt_nt5@log@boost@@YA?AVattribute_name@345@XZ)

(about 100 more similar errors)

It seems that boost::log is the only library I need that throws these errors, at least for now. Others such as filesystem seem to link just fine. I can resolve these if I change my defines from:

#ifndef WINVER
#define WINVER 0x0501   //XP
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 //XP
#endif                      

to:

#ifndef WINVER
#define WINVER 0x0600   //Vista
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600 //Vista
#endif                      

But of course this loses XP support. I'm hoping there's a way to get the best of both worlds.

0 个答案:

没有答案