Compiling / Building libJpeg for Windows

Here is a record of how I managed to build libJpeg for Windows, Visual Studio 2012:

1.) Download & unzip the source, I downloaded it from here:

http://sourceforge.net/projects/libjpeg/files/latest/download?source=files

2.) Launch the Visual Studio Command console. To launch it, search for ‘command’ in the start menu, and you should see something like ‘Developer Command Prompt for VS2012’, start this.

3.) in the command prompt cd to the directory in which the libJpeg source resides

4.) At the command prompt, run the following commands:

 
set INCLUDE=%INCLUDE%;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
copy jconfig.vc jconfig.h
copy makelib.ds jpeg.mak
copy makeapps.ds apps.mak
nmake /f makefile.vc  nodebug=1 libjpeg.lib
 

In the first command make sure to replace the path with your path to your installation of the windows SDK, you may have to look around for this… If you get an error like this:

.
makefile.vc(11) : fatal error U1052: file 'win32.mak' not found
.

Then you haven’t correctly specified the SDK path.

When the compile finishes you should see libjpeg.lib in the top folder.

.