using Microsoft Visual Studio’s C++ compiler commandline-wise — vcvarsall.bat

nice example illustrating how to properly qualify absolutely wherever possible (i.e. avoiding getting things found through PATH et al.!):

SET PF=C:Program Files
SET PFx86=C:Program Files (x86)
SET VSINSTALLDIR=%PFx86%Microsoft Visual Studio 10.0
:: Add compiler tools folder to the PATH variable.
:: Do not run this too many times
:: or %Path% will exceed the maximum limit.
call "%VCINSTALLDIR%vcvarsall.bat"
:: Microsoft Windows SDK for Windows 7 and .NET Framework 4 
:: (gets set by vcvarsall.bat)
::::SET WindowsSdkDir=...Microsoft SDKsWindows...

SET JAVA_HOME=%PF%Javajdk1.8.0_60
path %Path%;%JAVA_HOME%bin
javah HelloWorld
:: On Windows, the JNI library should not have a "lib" prefix
%VC%bincl /I%JAVA_HOME%include /I%JAVA_HOME%includewin32 /I%VC%include /I%VC%lib /I%MSDK%Lib libHelloWorld.c /FeHelloWorld.dll /LD
java HelloWorld

The wikipedia article got the batch file quoting wrong — of course I couldn’t help and I corrected that.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: