-
December 27th, 2008, 11:39 AM
#1
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.
-
December 28th, 2008, 05:08 AM
#2
Re: libjpeg problem
Don't use libjpeg. Useless on Win32 (JPEG is native)
-
December 28th, 2008, 07:49 AM
#3
Re: libjpeg problem
Originally Posted by fred100
Don't use libjpeg. Useless on Win32 (JPEG is native)
Do you know a tutorial how to use it?
-
December 28th, 2008, 02:14 PM
#4
Re: libjpeg problem
Originally Posted by fred100
Don't use libjpeg. Useless on Win32 (JPEG is native)
Again, native of who? [ http://www.codeguru.com/forum/showpo...08&postcount=4 ]
-
December 29th, 2008, 11:14 AM
#5
Re: libjpeg problem
Originally Posted by gung
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|