Visual Studio Developer Center > Visual Studio vNext Forums > Visual C++ General > building libjpeg with Visual Studio 2005

Answered building libjpeg with Visual Studio 2005

  • Monday, September 03, 2007 10:04 AM
     
     
    Hi,

    Im trying to build the static jpeg library from IJG code. Their instructions are for Developer Studio 4.2 and are a tad bit outdated:

    Code Snippet

    1. Copy jconfig.vc to jconfig.h, makelib.ds to jpeg.mak, and

       makeapps.ds to apps.mak.  (Note that the renaming is critical!)

    2. Click on the .mak files to construct project workspaces.

       (If you are using DevStudio more recent than 4.2, you'll probably

     get a message saying that the makefiles are being updated.)


      

    When I do double-click the .mak file, Visual studio conversion wizard comes up. But when I click finish, it throws the following error:

    Code Snippet

    The following error has occurred during XML parsing:

    File: C:\Documents and Settings\...\Desktop\jpegsr6b\jpeg-6b\jpeg.vcproj
    Line: 8
    Column: 13
    Error Message:
    Element 'Platforms' cannot be empty according to the DTD/Schema.

    The file 'C:\Documents and Settings\...\Desktop\jpegsr6b\jpeg-6b\jpeg.vcproj' has failed to load.


    What am I doing wrong?

    Thanks in advance,
    R

Answers

  • Monday, September 03, 2007 2:39 PM
    Moderator
     
     Answered
    If I were you, I'd find a different jpeg library, or just use GDI+. The project files for that library are obviously broken. You could, alternatively, just create a fresh static library / dll project and import the source files from the old project, but chances are that more than the project settings file has changed (language rules, compiler quirks etc).

All Replies

  • Monday, September 03, 2007 2:39 PM
    Moderator
     
     Answered
    If I were you, I'd find a different jpeg library, or just use GDI+. The project files for that library are obviously broken. You could, alternatively, just create a fresh static library / dll project and import the source files from the old project, but chances are that more than the project settings file has changed (language rules, compiler quirks etc).
  • Friday, September 07, 2007 1:48 PM
     
     

    If you downloaded it from http://www.ijg.org it hasn't been updated since 1998.

     

    You have a few options:

     

    There is a version that has been converted to C++ at http://eng.neologica.it/download/downloadIJGWin32.html - it has a Visual Studio .NET (2002) project in there which converts and compiles with no problems. Oh, you probably should define _CRT_SECURE_NO_WARNINGS in your project settings as well.

     

    It is possible to compile the original source with a bit of tinkering after you add it to an empty Win32 Static Library project. http://www.pocketpcdn.com/articles/jpeglib.html has a list of changes to the #defines in jmorecfg.h that fixes most of the errors. The rest of the article isn't much use, sadly.

     

    If you want to compile libjpeg as a dll, you need an export definitions (.def) file. I stole... erm, borrowed... one from http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16348 which is gnuwin32's implementation of the IJG source. Just download jpeg-6b-4-src.zip and hunt around inside it for jpeg.def - a quick search through MSDN will tell you what to do next.

     

    Hope that helps!

     

    Steve

  • Sunday, September 09, 2007 2:54 PM
     
     

    Hi!

     

    I managed to compile latest libjpeg with Visual Studio 2005 command-line tools (nmake) without any errors except for 'security deprecated' warnings. See the original instructions I found at http://www.nevrax.org/tikiwiki/tiki-index.php?page=libJPEG (they are for MSVS 7.1 but work for 2005 as well).

     

    To cut a long story short:

    1) Decompress the archive to some_folder

    2) Rename jconfig.vc to jconfig.h and makefile.vc to makefile

    3) Run Visual Studio Command Prompt and cd to some_folder

    4) Run 'nmake clean all' command

     

    Hope this still is actual info for you Smile

     

    Best regards,

     

    Anton.

     

  • Monday, October 13, 2008 2:24 PM
     
     
    works a treat for VS2008 too - many thanks Anton
  • Wednesday, November 05, 2008 8:35 PM
     
     
    keywords: Visual Studio vc .net jpeg libjpeg jpeg62.dll jpeg62.def jpegdll.def libjpeg.def libjpeg.dll IJG SIMD SSE SSE2 MMX 3dnow cpu usage dynamic library


    here are the answers to the following questions:

    * how do I create a .def file for the libjpeg library?
    * how do I create both static and dynamic libraries for the libjpeg library?
    * how can I speed up the libjpeg library on x86 mmx,sse,sse2,3dnow machines? (soon AMD/AMD64)

    *how to create a jpeg62.def jpegdll.def libjpeg.def file to create a win32 dll for the IJG JPEG library source.

      sed -e "/\(jinit\|jpeg_simd_\(cpu\|os\|merged\)\)/d" -e "s/^EXTERN(..*) \([_A-Za-z][_A-Za-z0-9]*\).*/  \1/p" -e d jpeglib.h jpegint.h >jpegdll.def

    *how to compile the ijg libjpeg library into both a static and a dynamic linked libraries using the visual studio vc .net compilers.

      1) download the ijg source code from ;

               ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpegsr6.zip

      2) download the jpegsr6-dll.zip (jpegdll.def, jpegdll.rc, makefile.vcdll) file from ;

               http://www.4shared.com/file/69911226/780fc2e5/jpegsr6-dll.html

      3) uncompress both the jpegsr6 jpegsr6-dll archives into the same folder
     
      4) change into the jpeg-6b directory using the visual studio command prompt

      5) copy jconfig.vc to jconfig.h

      6) nmake /f makefile.vcdll all ; if you want to build just static library use /f makefile.vc

    now do a dir jpeg62.* and you should see both a .lib and .dll files.

    *how to speed up the IJG JPEG library by a factor of two or three times normal with the x86 SIMD extension. to see any improvement, you will need to be running on a machine that has a cpu that supports SIMD extentions.

    in order to compile the modified ijg jpeg library, you will need an assembler. You will need to get and install the netwide assembler (nasm) from http://www.nasm.us/

      1) download the nasm-2.xx.xx-win32 from ;

                http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-win32.zip
     
      2) uncompress the nasm-2.xx.xx-win32 archive

      3) copy nasm.exe somewhere it will be seen in the path ... I just put mine in C:\WINDOWS

    now to compile the x86 SIMD extension modified ijg library ...

      1) download the source code for the x86 SIMD extension modified ijg library;

               http://cetus.sakura.ne.jp/softlab/jpeg-x86simd/sources/jpegsrc-6b-x86simd-1.02.zip

      2) uncompress the jpegsrc-6b-x86simd-1.02 archive

      3) change into the jpeg-6bx directory using the visual studio command prompt

      4) edit the makefile.vcdll and change "NASM= nasmw" to "NASM= nasm" (guess they change the name?)

      5) copy jconfig.vc to jconfig.h

      7) nmake /f makefile.vcdll all ; if you want to build just static library use /f makefile.vc here

    now do a dir jpeg62.* and you should see both a .lib and .dll files with the x86 SIMD extension support.

    links:

    home of the original ijp libjpeg library - http://www.ijg.org/
    source of x86 SIMD extension for IJG JPEG library (japanese) - http://cetus.sakura.ne.jp/softlab/jpeg-x86simd/jpegsimd.html


    sfranzyshen
    • Edited by sfranzyshen Wednesday, November 05, 2008 8:38 PM
    •  
  • Wednesday, March 18, 2009 9:43 AM
     
     
    Can someone tell where I can download the jpegsr6-dll.zip. The link is broken.

    Or a link to the source with project files for a dynamic library. All the projects I have seen are for static building.
  • Saturday, March 21, 2009 10:07 AM
     
     
    You don't need libjpeg on Windows.
    JPEG format is native for about 10 years in Win32
  • Tuesday, March 24, 2009 9:59 AM
     
     
    We use libjpeg because we are programming our code for windows and linux. On linux we are using it for a while so we cannot easily pick other one.

    What do you use under windows then?
  • Tuesday, February 02, 2010 1:29 PM
     
     
    Works great (VS2005)! Thank you!
  • Tuesday, June 29, 2010 9:06 PM
     
     Proposed Answer

    This is a pretty old question, but I was running into the same problem, and a Google search brought me here.  Turns out that the IJG folks made it much easier for VS developers lately.  You basically just have to download the source from the IJG website (http://www.ijg.org/), unzip it, and then follow the instructions in the install.txt file.  The relevant portions for Visual Studio 2010 are:

    1. Open the command prompt, change to the main directory and execute the command line

    NMAKE /f makefile.vc  setup-v10

       This will move jconfig.vc to jconfig.h and makefiles to project files.  (Note that the renaming is critical!)

    2. Open the solution file jpeg.sln, build the library project.  (If you are using Visual Studio more recent than 2010 (v10), you'll probably get a message saying that the project files are being updated.)

    3. Open the solution file apps.sln, build the application projects.

    4. To perform the self-test, execute the command line

    NMAKE /f makefile.vc  test-build

    5. Move the application .exe files from `app`\Release to an appropriate location on your path.



    Ken Smith
    • Proposed As Answer by mushadow Wednesday, April 20, 2011 1:55 PM
    •  
  • Monday, April 18, 2011 8:03 PM
     
     
    could you direct me to where in the msdn it's supported under win32?