Isolating MSVC 14.0 C/C++ compiler
[page last modified 2016-05-28]
Microsoft's Visual Compiler version 14.0 was released in July 2015:
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
It includes an optimizing C/C++ compiler and linker, and is available in a free (Visual Studio Community) version: Microsoft Visual C
Unfortunately (depending on point of view) the installation includes a
plethora of visual tools and programming languages one might not be interested
For instance, I only wanted the command line C/C++ tools and Windows API headers and libraries.
In the old days (eg MSVC 6.0) isolating the necessary tools, dll's and Windows SDK was easy. Now it can be confusing. The .BAT provided here isolates MSVC 14.0 -- but only that specific version.
The first step is to install the compiler. If you wish to erase it
later, be sure to image the target system first (the uninstaller leaves
I install into a virtual machine, then discard the modified virtual machine image after I have extracted the compiler.
The next step is to run copymsvc14.bat, supplying as its argument a nonexistent directory in which to place the isolated compiler. The .bat file only performs XCOPY commands... nothing more.
Finally archive the created directory tree -- I use 7-zip for that. My .7z archive is 88 meg. Move the archive to the system that will house the isolated compiler, extract the tree, and you're done.
Both 32 and 64 bit X86/AMD64 compilers are included in the result.
The .bat file assumes English language (copies \1033\ folders). This may have to change if you have installed using a localized language.
Example of use: copymsvc14 msvc14_0
Once copied, enter msvc14_0\bin and execute CL.exe to see if things worked.
To create an exe (eg "Hello World!") you need to set up the compiler environment variables:
set include=msvc14_0\include;msvc14_0\sdk\include set lib=msvc14_0\lib;msvc14_0\sdk\lib set path=msvc14_0\bin;%path%
To generate 64-bit, set up the lib and path as follows (include doesn't change):
You only need the \sdk\ elements if using the Windows SDK libraries.set lib=msvc14_0\lib\amd64;msvc14_0\sdk\lib\x64 set path=msvc14_0\bin\x86_amd64;msvc14_0\bin;%path%
9/18/2015 Initial version released
5/28/2016 Updated for compiler installs to Win 32-bit systems
Click here to download copymsvc14.bat
@echo off& setlocal& set x86=& set w32=system32 rem http://paulhoule.com/msvc14/copymsvc14.bat May 28, 2016 if "%~1"=="" echo Copies minimal files to run CL 14.0 (32 and 64 bit) if "%~1"=="" echo First arg must be target directory& goto :eof if exist "c:\Program Files (x86)\." set "x86= (x86)"& set w32=syswow64 set vs1=c:\Program Files%x86%\Microsoft Visual Studio 14.0 set vs2=c:\Program Files%x86%\Windows Kits\10 set vs3=c:\Program Files%x86%\Windows Kits\8.1 set emsg=Can't find src dir - run on system where compiler is installed if exist "%vs1%" if exist "%vs2%" if exist "%vs3%" set emsg= if not "%emsg%"=="" echo %emsg%& goto :eof if exist "%~1" echo dir "%~1" exists... delete it first& goto :eof echo Copying binaries (bin, sdk\bin).......... xcopy /i "%vs1%\VC\bin" "%~1\bin" >nul xcopy /i "%vs1%\VC\bin\1033" "%~1\bin\1033" >nul xcopy /i "%vs1%\VC\bin\x86_amd64" "%~1\bin\x86_amd64" >nul xcopy /i "%vs1%\VC\bin\x86_amd64\1033" "%~1\bin\x86_amd64\1033" >nul xcopy /i "%vs3%\bin\x86" "%~1\sdk\bin" >nul xcopy /i "%vs3%\bin\x86\1033" "%~1\sdk\bin\1033" >nul xcopy /i "%vs3%\bin\x64" "%~1\sdk\bin\x64" >nul xcopy /i "%vs3%\bin\x64\1033" "%~1\sdk\bin\x64\1033" >nul xcopy c:\windows\%w32%\api-ms-win-*.dll "%~1\bin" >nul xcopy c:\windows\%w32%\*140*.dll "%~1\bin" >nul xcopy c:\windows\%w32%\ucrtbase*.dll "%~1\bin" >nul xcopy c:\windows\%w32%\VsGraphicsHelper.dll "%~1\bin" >nul echo Copying includes (include, sdk\include).......... xcopy /i "%vs1%\vc\include" "%~1\include" /s >nul xcopy /i "%vs2%\include\10.0.10150.0\ucrt" "%~1\include" /s >nul xcopy /i "%vs3%\include\shared" "%~1\sdk\include" /s >nul xcopy /i "%vs3%\include\um" "%~1\sdk\include" /s >nul echo Copying libraries (lib, sdk\lib).......... xcopy /i "%vs1%\VC\lib" "%~1\lib" >nul xcopy /i "%vs2%\lib\10.0.10150.0\ucrt\x86" "%~1\lib" >nul xcopy /i "%vs3%\lib\winv6.3\um\x86" "%~1\sdk\lib" >nul xcopy /i "%vs1%\VC\lib\amd64" "%~1\lib\amd64" >nul xcopy /i "%vs2%\lib\10.0.10150.0\ucrt\x64" "%~1\lib\amd64" >nul xcopy /i "%vs3%\lib\winv6.3\um\x64" "%~1\sdk\lib\x64" >nul
You are visitor 13166 Go to Home Page