Targetting Windows xp from visual studio 2015 enterprise update 1

后端 未结 2 635
春和景丽
春和景丽 2021-01-23 05:01

I would like to know whether we can build the projects/binaries using visual studio 2015 which can run on Windows xp ? If its supported then how we can build ?

2条回答
  •  不知归路
    2021-01-23 05:59

    As mentioned by dxiv Windows XP can be targeted from visual studio using the correct Platform toolset (Visual Studio 2015 - Windows XP (v140_xp)).

    This is not in all cases sufficient. Because the vs compiler was extended by propper thread local storage (TLS) handling there is an additional change needed. The new TLS is not properly supported by Windows XP and therefore static objects in dll's will not be initialized. If you want to avoid this problem us the additional compiler flag /Zc:threadSafeInit- to disable this problematic feature.

    If you would like to use boost, you have to build it yourself. To make it compatible with Windows XP the following options have to be added :

    1) run these commands before the build with b2 (bjam)

    CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
    SET "INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%"
    SET "PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%"
    SET "LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%"
    

    2) use these additional options for b2

    toolset=msvc-14.0 
    address-model=32 
    define=BOOST_USE_WINAPI_VERSION=0x0501 
    define=_USING_V110_SDK71_ 
    linkflags=/SUBSYSTEM:CONSOLE,5.01 
    cxxflags="/Zc:threadSafeInit- "
    

    Note:

    • the define is _USING_V110_SDK71_ not _USING_V140_SDK71_.
    • the space in cxxflags="/Zc:threadSafeInit- " is intentional du to a bug in b2 which would remove the trailing "-"

提交回复
热议问题