libjpeg problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: libjpeg problem

  1. #1
    Join Date
    Dec 2008
    Posts
    3

    libjpeg problem

    I've just installed the ijg jpeg library and wanted to give it a try. But for some reasons it crashes.
    Here is my code:

    /*
    * test.cpp
    *
    * Created on: 10.12.2008
    *
    */

    #include<iostream>
    #include<stdlib.h>

    using namespace std;

    #include <jconfig.h>
    #include <jerror.h>
    #include <jmorecfg.h>
    #include <jpeglib.h>

    int main()
    {
    struct jpeg_compress_struct cinfo;
    struct jpeg_error_mgr jerr;

    JSAMPLE image[800];
    int i;
    for(i=0;i<800;i++)
    {
    //image[i]=char(i%50);
    }

    cinfo.err = jpeg_std_error(&jerr);
    jpeg_create_compress(&cinfo);

    cinfo.image_width = 800; /* image width and height, in pixels */
    cinfo.image_height = 600;
    cinfo.input_components = 1; /* # of color components per pixel */
    cinfo.in_color_space = JCS_GRAYSCALE; /* colorspace of input image */

    jpeg_set_defaults(&cinfo);

    jpeg_start_compress(&cinfo, TRUE);

    JSAMPROW row_pointer[1];
    int row_stride;
    row_stride = 800;

    while (cinfo.next_scanline < cinfo.image_height)
    {
    row_pointer[0] = & image[0];
    jpeg_write_scanlines(&cinfo, row_pointer, 1);
    }

    jpeg_finish_compress(&cinfo);

    return 0;
    }

    By debugging, I found out, that it crashes at "jpeg_start_compress(&cinfo, TRUE);".

    I'm using mingw with eclipse ganimede under windows vista. I linked (-l) jpeg, libgsl, libgslcblas and libjpeg. I can't link jpeg-bcc.lib. When I try to do so, I get an error:

    GnuWin32\lib/jpeg-bcc.lib: file not recognized: File format not recognized
    collect2: ld returned 1 exit status
    Build error occurred, build is stopped

    I hope anyone can help me with it.

  2. #2
    Join Date
    Jan 2008
    Posts
    178

    Re: libjpeg problem

    Don't use libjpeg. Useless on Win32 (JPEG is native)

  3. #3
    Join Date
    Dec 2008
    Posts
    3

    Re: libjpeg problem

    Quote Originally Posted by fred100 View Post
    Don't use libjpeg. Useless on Win32 (JPEG is native)
    Do you know a tutorial how to use it?

  4. #4
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,051

    Re: libjpeg problem

    Quote Originally Posted by fred100 View Post
    Don't use libjpeg. Useless on Win32 (JPEG is native)
    Again, native of who? [ http://www.codeguru.com/forum/showpo...08&postcount=4 ]
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  5. #5
    Join Date
    Dec 2008
    Posts
    114

    Re: libjpeg problem

    Quote Originally Posted by gung View Post
    Do you know a tutorial how to use it?
    You can ask on Advanced Win32 api newsgroup :
    news://comp.os.ms-windows.programmer.win32
    where all native methods to read any file format have been explained
    (even undocumented ones...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center