Change Visual C ++ vcvars32.bat for target XP platform

I found a post from user Stack Overflow Eoin showing how he modified vcvars32.bat for VC ++ 2012 (I'm using 2013):

:x86
if not exist "%~dp0bin\vcvars32.bat" goto missing
call "%~dp0bin\vcvars32.bat"
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%
set CL=/D_USING_V110_SDK71_;%CL%
goto :SetVisualStudioVersion

      

Here is my section before the change:

:x86
if not exist "%~dp0bin\vcvars32.bat" goto missing
call "%~dp0bin\vcvars32.bat"
goto :SetVisualStudioVersion

      

After applying the above modification, I built the "hello world" application using CL (cl main.cpp), but the executable does not run on Windows 2003. If built with the IDE with the option specified, it works fine.

Can someone shed some light on what's going on?

PS The reason I need to do this is I need to build the Boost Libraries using XP Platform options in order for my application to run on Windows 2003. There is no solution or project to build Boost and this is done via the command line using their Bootstrap procedure and Bjam which doesn't have the XP Platform option.

+3


source to share


1 answer


Everything Eoin's Stack Overflow suggested was accurate, except that his answer did not contain the necessary setting for% LINK%

Here's my job: x86 section:

:x86
if not exist "%~dp0bin\vcvars32.bat" goto missing
call "%~dp0bin\vcvars32.bat"
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%
set CL=/D_USING_V110_SDK71_;%CL%
set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%
goto :SetVisualStudioVersion

      



I hope people who create solutions that require XP and Windows 2003 compatibility find this useful.

Full information:

http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx?PageIndex=2

+2


source







All Articles