Compiling libjpeg

To compile libjpeg 9 in Visual Studio 2012, here are the steps (after unzipping the archive file):

  1. Download the file WIN32.MAK (for example, from http://www.bvbcode.com/code/f2kivdrh-395674-down), and place a copy in the root source code directory (possibly C:\jpeg-9, but it depends where you unzipped it). I will refer to this directory as %jpegsrc% from now on. Having this file is important; otherwise step 3 will produce an error.

  2. In the Visual Studio command prompt, open to %jpegsrc%:

    cd %jpegsrc%

  3. At the same command prompt, execute the following:

    NMAKE /f makefile.vc setup-v10

    This will create two Visual Studio 2010 solutions in %jpegsrc%: jpeg.sln and apps.sln.

  4. Open each solution in Visual Studio 2012. Each one will prompt you to update all the projects to 2012 format. Click on “Update.” One time I did it, the prompt did not appear. In case that happens, right-click on the jpeg solution in the Solution Explorer, and choose “Update VC++ projects…,” which will produce the same prompt.

  5. Save and build each solution as normal. (You have to build the jpeg.sln solution before apps.sln, since the latter depends on the former.)

Note: this process should work correctly in Visual Studio 2010, without the updating, but I have not tested it.

Update: This method still works in Visual Studio 2015 for libjpeg-9a.

Leave a Comment